MATLAB Statistical Functions

Main.MatlabFunctions History

Hide minor edits - Show changes to output

April 26, 2016, at 12:48 PM by -
Added lines 38-45:

!!!! Custom MATLAB Functions

User-defined MATLAB functions are custom routines that accept inputs, perform some type of specialized calculation, and return and output. This tutorial exercise demonstrates how to create a custom script file and use it to perform custom calculations.

<iframe width="560" height="315" src="" frameborder="0" allowfullscreen></iframe>
Added lines 1-60:
(:title MATLAB Statistical Functions:)
(:keywords big data, data analysis, Mathworks, MATLAB, statistics, average, min, max, stdev, university course:)
(:description Introduction to statistical functions in MATLAB, implemented to analyze a data set:)

The following tutorial is an introduction to MATLAB functions such as average, standard deviation, maximum, minimum, and conditional counting.

<iframe width="560" height="315" src="" frameborder="0" allowfullscreen></iframe>

!!!!MATLAB Source Code

 % clear session and screen
 clear all; clc
 % create a new column vector with 10 elements
 %  with random numbers between 0 and 100
 y = rand(10,1) * 100;
 % basic statistics
 % define a new anonymous function
 avg = @(x) sum(x)/length(x)
 % check new function
 disp('Average with avg function: ')
 disp('Average with mean function: ')
 % number of values below 50
 % boolean vector of 0 or 1 values
 % display result
 disp('Number of values below 50: ')
 z = y<50;

!!!!Additional Tutorials

Data statistics can also be completed with a spreadsheet program  like [[Main/ExcelFunctions|Microsoft Excel]] and [[Main/PythonFunctions|Python]] where the data sets are arrays or matrices instead of tables in a spreadsheet. Click on the appropriate link for additional information and source code.


 <div id="disqus_thread"></div>
    <script type="text/javascript">
        var disqus_shortname = 'apmonitor'; // required: replace example with your forum shortname

        /* * * DON'T EDIT BELOW THIS LINE * * */
        (function() {
            var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
            dsq.src = 'http://' + disqus_shortname + '';
            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
    <noscript>Please enable JavaScript to view the <a href="">comments powered by Disqus.</a></noscript>
    <a href="" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>