Question: In a script file names LASTNAME_PROB 1.M, write a script according to the following specification. Before starting, clear all workspace variables and the command window
In a script file names LASTNAME_PROB 1.M, write a script according to the following specification. Before starting, clear all workspace variables and the command window contents. Given d(x) = (x -1) (10 - e^x-1), perform the following using a combination of one or more if-end statements and a for-end statement having a loop variable named x representing values form 4 down to -2 in steps of 0.01: compute the current (scalar) value of a variable named d that represents the current (scalar) value of d(x) corresponding to the current (scalar) value of loop variable x. Compute dMax, the maximum value of d within the range x = [-2, 4] you may not use any built in functions, including min() or max (). Compute xMax, the value in the range x=[-2, 4] causing dmax to occur. You may not use any built-in functions, including min () or max (). Display the value of dmax and xMax to the command window. Print each value as a real umber showing a maximum of 4 digits beyond the decimal point. A sample script output is shown below. in a script file named LASTNAME_PROB 2. M, write a script according to the following specification. Before starting clear all workspace variable and the command Window contents. Create a variable named V and assign to it a 100- element now vector where each element in the row vector is a randomly generated integer chosen uniformly from the interval (-100, 200). Compute the average of the elements contained in vector V that are greater than or equal to - 40, less than 140, but not equal to 60. Use IF -end statement(s) in combination with for-end statement (s) having a loop variable named k and a loco array representing the indices of function, including sum() and mean (). Display the average from step (b) in the command window as a scientific notation number showing a maximum of 3 digits beyond the decimal point. A sample programs output is shown below
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
