Question: 1) You are to construct a program to compute the STANDARD DEVIATION of a group of numbers The standard deviation gives one a sense of
1) You are to construct a program to compute the STANDARD DEVIATION of a group of numbers The standard deviation gives one a sense of the spread of data around the mean (what we called mo average above) i. Create the m-file like fcreate, m as Illustrated above. Run it to print out the following numbers m a data file called num.txt. Print it up with the type command 3.2 3.1 3.5 3.2 3.0 3.1 3.9 3.6 3.9 3.6 3.9 3.4 3.2 3.3 6.7 3.6 3.7 3.7 ii. Now create the program called stand m to compute the standard deviation of the data it obtains from the data file num.txt M Outputs of the numbers and their deviations calculated as below should be in labeled columns iii Program should load the above data file which is now a vector! iv. Compute the sum of all of the numbers: Output this value Use sum()! Not a Scalar calculation! v. Obtain the average (called the mean value in statistics) and output it. Use mean() vi. Compute the difference of each value from the average called the deviation using a for loop and an expression like dev(i)=num(i)-ave; output it along with its number(i) in labeled table Here we treat each number individually as a scalar and thus create a new vector dev in the end. vii. Simultaneously (within the same loop) compute the sum of an the deviations call it the checksum and output it after the loop, le; checksum =? viii. Simultaneously sum all the squares of the deviations In the loop. ix. Compute the average of the last sum (the average of the deviations squared). Use one less than the total number This number is cared the variance in statistics and output it. x. Compute the squareroot of the variance - known as the standard deviation and output it. xi. Have your program use the MATLAB function std() on the row vector of numbers1 Output these values and compare them with your calculations above What are the differences if any? Show percent difference if there is a difference It should be very close if not 0! The program you construct will carry out all actions discussed in the above 12 parts. Print program (type filename) and output and the data file to hand in
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
