Main

MATLAB Statistical Functions

Main.MatlabFunctions History

Hide minor edits - Show changes to output

April 26, 2016, at 12:48 PM by 45.56.3.173 -
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.

(:html:)
<iframe width="560" height="315" src="https://www.youtube.com/embed/o8gqf9cyfpI" frameborder="0" allowfullscreen></iframe>
(:htmlend:)
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.

(:html:)
<iframe width="560" height="315" src="https://www.youtube.com/embed/gHWkS2CyScs" frameborder="0" allowfullscreen></iframe>
(:htmlend:)

!!!!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;
 disp(y)
 % basic statistics
 mean(y)
 max(y)
 min(y)
 std(y)
 % define a new anonymous function
 avg = @(x) sum(x)/length(x)
 % check new function
 disp('Average with avg function: ')
 avg(y)
 disp('Average with mean function: ')
 mean(y)
 % number of values below 50
 % boolean vector of 0 or 1 values
 disp(y<50)
 % display result
 disp('Number of values below 50: ')
 z = y<50;
 disp(sum(z))

!!!!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.

----

(:html:)
 <div id="disqus_thread"></div>
    <script type="text/javascript">
        /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
        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 + '.disqus.com/embed.js';
            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
        })();
    </script>
    <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
    <a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
(:htmlend:)