Question: 1 PlottingCreate a MATLAB script that completes the following tasks: 1 . Reset commuting environment: ( a ) Clear workspace ( b ) Close all

1 PlottingCreate a MATLAB script that completes the following tasks:1. Reset commuting environment:(a) Clear workspace(b) Close all figure windows2. Setup data:(a) Create a row vector x with values 1 to 10(b) Create a row vector y1 containing 10 random numbers(c) Create an array y2 equal to 4 times y1 squared3.2D plot:(a) Open a new figure window(b) Plot the vector y1 as a function of the vector x (y1 vs x)(c) On the same figure, plot the vector y2 as a function of the vector x (y2 vs x)4. Customise lines and markers: Open a new figure window and recreate the same y1 vs x plot but: Set the line style to dashed; Set the marker style to circles; Set the line width to 2; and Set the marker size to 85. Set axis range:(a) Set the x-axis range from 2 to 8 and the y-axis range from 0.2 to 0.8(>> help axis)6. Make your figure intelligible to others:(a) Give your figure a title(b) Label the x and y axes(c) Add a legend2 Logical, relational and conditional statementsCreate a 2nd MATLAB script that completes the following tasks:1. Reset commuting environment:(a) Clear workspace(b) Close all figure windows12. Create a 10\times 10 matrix of uniformly distributed random numbers and run the following tests:(a) Tests if any values are greater than 0.5,0.9, and 0.99(b) Finds the indices where values are greater than 0.99(c) Finds if all values are greater than 0.5,0.1, and 0.01(d) Sets the values which are greater than 0.99 equal to 1For each test use the disp function to output sensible text3. Create two 5\times 5 matrices, r1and r2, each filled with uniformly distributed random numbers(a) Test which of the values in r1 are greater than their counterparts in r2(b) Test which the values in r1 are greater than 0.5,0.9, and 0.99. Your tests should return a 5\times 5matrix of logical values3 Functions1. Basic script:(a) Clear all variables in your workspace(b) Create two variables a=2 and b=3(c) Write a script which multiplies these variables together and saves the result in a variable, c(d) Save your script using a suitable name.(e) Run your script, and note that the variable c remains in the current workspace after the scripthas finished2. Convert your script to function one part at a time:(a) Modify the (one-line) script from question 1 by adding the function keyword, then the nameof the function on line 1(give your function a suitable name). On line 3 add the end keyword(b) Run your function. Why doesnt it work? (Look at the error message in the command windowfor clues.)(c) Modify the function so that it takes two input arguments(d) Confirm that your function runs, using the variables a and b in as input arguments(e) Clear the variable c from your workspace, then rerun the function - why is the calculatedvariable c not in your workspace?(f) Finish the function by adding an output argument(g) Re-run your function with c as the output argument and a and b as the input arguments.Confirm that the output variable c is now in your workspace.Submit all files together on Blackboard

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!