In data analysis, standard deviation and variance are very important aspects in terms of interpretation of varios datas. These datas can be saved as matrices and vectors in Matlab. So, you can easily calculate the variances and standard deviations of matrices and vectors in Matlab with ‘std()’ and ‘var()’ commands. In here, we explain how to use these commands in Matlab.
What Is Variance And Standard Deviation?
As you see above, the formulas of variance and standard deviations are very basic. For a lots of datas, calculation of varience and standard deviations can be very troublesome with hand. So, as a good engineer or mathematician, you can use computational methods to calculate them. One of these methods is, using Matlab.
How To Use ‘std()’ And ‘var()’ Commands In MatLab?
a = [2 6 3; 4 6 3; 11 69 31]; b = [2 65 2 9 46 12 38]; var(a) %the first std(a) %the second var(b) %the third std(b) %the fourth ans = 1.0e+03 * 0.0223 1.3230 0.2613 ans = 4.7258 36.3731 16.1658 ans = 615.4762 ans = 24.8088
In command window of Matlab, matrix ‘a’ and vector ‘b’ are created as you see above. And there are four of uses ‘var()’ and ‘std()’ commands.
In the first use of ‘var()’ command above, variance of matrix ‘a’ is directly calculated. All the variance values are calculated for columns of matrix ‘a’. You can check the first answer that appeared in command window in Matlab.
The second one is about the calculation of standard deviation of the matrix ‘a’. The standard seviation is also calculated for all rows for matrix ‘a’. Chech the second answer above.
The third one is about the use of ‘var()’ command in Matlab for vector ‘b’. As you see calculation is veyr basic, the variance value is calculated. The same logic is also valid for standard deviation above as you see. Check the third and fourth answers respectively.
YOU CAN LEARN MatLab IN MECHANICAL BASE; Click And Start To Learn MatLab!
As you see, the use of ‘std()’ and ‘var()’ commands are very basic in Matlab to calculate standard deviations and variances of matrices and vectors. Do not forget to leave your comments and questions about ‘var()’ and ‘std()’ commands in Matlab below.
Your precious feedbacks are very important for us.