Write a MATLAB script that will prompt the user to enter two

Write a MATLAB script that will prompt the user to enter two data series (series 1, series 2) and a string (title of the plot). Plot a graph with series-1 in x-axis, series-2 in y-axis and use the string as the title of the plot.

Use MATLAB function called “MyFunction” (you need to define it)

The function will take one data array as input argument and calculate it’s Total, Average, and Standard-deviation. Use this function to calculate the total, average and std-dev of series-2 and print the result with proper labeling.

Example:

>> Please enter series-1:

>> Please enter series-2:

>> Please enter the title:

[Not it will plot the data with proper title]

[also it will print…

The total for data series-2 is: ____

The average is: _____

The standard deviation is: ______

]

Solution

function MyFunction
A=[1 2 3 4 5 6 7 8 9 10]
n=input(\'Please enter series-\');
if n==1
disp(\'The total for data series-2 is:\');
sum(A)
end
if n==2
disp(\'The average is: \')
(sum(A))/numel(A)
end
if n==3
disp(\'The standard deviation is:\')
x=std(A)
end
end

Write a MATLAB script that will prompt the user to enter two data series (series 1, series 2) and a string (title of the plot). Plot a graph with series-1 in x-

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site