This is for Matlab 2 Write a function stats with function de
This is for Matlab
2. Write a function stats with function declaration line 10 points for the function, 3 points for the 3 figures begin code function S = stats (data) end code to perform a simple statistical analysis on a given set of data. The input data may be a 1-by-N or N-by-1 array containing the data we want to analyze. The output S is a 1-by-1 structure array containing information about data saved with the following fieldnames Saved info Mean Mode Median Standard Deviation stddev Variance Maximum Value Minimum Value fieldname mean mode median variance max minSolution
ab=randi(100,[10,1]);
>> field1 = \'mean\'; value1 = mean(ab);
>> field2 = \'mode\'; value2 = mode(ab);
>> field3 = \'median\'; value3 = median(ab);
>> field4 = \'std\'; value4 =std(ab) ;
>> field5 = \'variance\'; value5 =(std(ab))^(1/2) ;
>> field5 = \'max\'; value5 =max(ab);
>> field6 = \'min\'; value6 =min(ab);
>> s = struct(field1,value1,field2,value2,field3,value3,field4,value4,field5,value5,field6,value6)
s =
mean: 60.3000
mode: 76
median: 58
std: 21.4064
max: 92
min: 29
