Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a MATLAB script to; 1- Create a 1 x m 1D array of random real numbers between -5 to 10. Where m is user

image text in transcribed
Write a MATLAB script to; 1- Create a 1 x m 1D array of random real numbers between -5 to 10. Where m is user entry between 500 to 1000. Assign the created array to variable R1DA. Note: if a user enters an out of range number, your code should ask again for the entry. Following Lec10, check the rand function for generating random numbers between 0 and 1. You should use this function in this part. 2- Write a local function, named MSD1DA, in your script to take RIDA as an input argument, and output the mean and standard deviation of RIDA. Use variable MN for mean and SD for standard deviation in your function and also in your code. 3- Call MSD1DA in your main code to calculate the mean and standard deviation of R1DA. 4. Plot the RIDA using red dots. In your plot, the X-axis is the element number, and Y-axis is the element value. On this plot, also include a horizontal blue solid-line representing the mean value of RIDA. Additionally, on this plot include two more horizontal green dash-lines showing the standard deviation lines with respect to mean value. Do not forget to include axis labels and legend in your plot. Note: you should not draw the horizontal lines on your plot. You should include these lines by including additional input arguments in the plot command. For example, the mean line can be included in your plotas: Plot(.,[0 m], [MN MN], 'b',...) Additionally you can explore axis command in MATLAB to see how to set axis limits and aspect ratios of your plot box. For example, include the below command after your plot command in your script. axis(11 m -6 13]); Hint: For example, by running your code for a 750 entry the command window and figure window should represent: This program creates a lxm array of random elements between -5 to 10 Enter the size of the array (your entry should be between 500 and 1000 750 DU

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions

Question

What is meant by present value? Does it take account of inflation?

Answered: 1 week ago