Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1 PlottingCreate a MATLAB script that completes the following tasks: 1 . Reset commuting environment: ( a ) Clear workspace ( b ) Close all
PlottingCreate a MATLAB script that completes the following tasks: Reset commuting environment:a Clear workspaceb Close all figure windows Setup data:a Create a row vector x with values to b Create a row vector y containing random numbersc Create an array y equal to times y squaredD plot:a Open a new figure windowb Plot the vector y as a function of the vector x y vs xc On the same figure, plot the vector y as a function of the vector x y vs x Customise lines and markers: Open a new figure window and recreate the same y vs x plot but: Set the line style to dashed; Set the marker style to circles; Set the line width to ; and Set the marker size to Set axis range:a Set the xaxis range from to and the yaxis range from to help axis Make your figure intelligible to others:a Give your figure a titleb Label the x and y axesc Add a legend Logical, relational and conditional statementsCreate a nd MATLAB script that completes the following tasks: Reset commuting environment:a Clear workspaceb Close all figure windows Create a times matrix of uniformly distributed random numbers and run the following tests:a Tests if any values are greater than and b Finds the indices where values are greater than c Finds if all values are greater than and d Sets the values which are greater than equal to For each test use the disp function to output sensible text Create two times matrices, rand r each filled with uniformly distributed random numbersa Test which of the values in r are greater than their counterparts in rb Test which the values in r are greater than and Your tests should return a times matrix of logical values Functions Basic script:a Clear all variables in your workspaceb Create two variables a and bc Write a script which multiplies these variables together and saves the result in a variable, cd 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 finished Convert your script to function one part at a time:a Modify the oneline script from question by adding the function keyword, then the nameof the function on line give your function a suitable name On line add the end keywordb 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 argumentsd Confirm that your function runs, using the variables a and b in as input argumentse 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 argumentg Rerun 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started