Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

2. Write the matlab code to create a vector z with values running from 9.68 down

ID: 1853175 • Letter: 2

Question

2. Write the matlab code to create a vector z with values running from 9.68 down to -3.14 with stepsize -.001 , suppressing the display of the output at the time of the computation. 3. Write the matlab code to create a vector w of 4000 equally spaced points running from 0 up to 42, supressing the display of the output. 4. Suppose you have a vector v of numerical values and wish to nd the maximum value in the array, vmax, and its location, imax. Write the matlab code to fetch both vmax and imax simultaneously. 5. Write the matlab code to nd the sum of the values in the array v and store it in the variable vsum 6. Write the matlab code to nd the average value (also called the mean) of the values in the array v, storing the result in the variable vmean 7. Write the matlab code to produce a plot of the closed quadrilateral whose corners are at (0; 0); (1; :5); (2;??2); (1;??2), using a black solid line. 8. Write the matlab code to overlay on the same plot just produced in question 7.) the plot of the curve u = sin(x) with x running from 0 to 2, with a stepsize .01, using a green dashed line. Be sure to write the code setting up x and u rst, and make sure the plot from 7.) doesn't disappear when you produce and overlay this second plot on top of it. 9. Given two vectors of the same size, p and q , write the matlab code to produce the dot product (sum of the products of the components of p and q ) and store it in the variable pdotq . 10. Write the matlab code to nd the length of the vector p, storing this in the variable plength 11. Given any array A, write the matlab code to nd the number of rows and columns in A, storing the results in the variables nrows and ncols 12. Give the matlab code to produce a n by 1 column vector R of uniformly random values. Assume n is already assigned a value. 13. Suppose I make the following matlab call to a function named doggies: > [rosie, psistar, ugly] = doggies( sally, keena) What are the values of nargin and nargout when this call is made? 14. In any matlab function implementation le, what should immediately follow the function prototype in this le, and what formatting requirement does this need to obey ? 15. Suppose I have three vectors, all of the same size, t, velocity, height, and I wish to plot in a single gure window, broken into 2 panes, stacked vertically, the curve t vs. velocity in the top pane, using a red solid line, and the curve t vs. height in the bottom pane, using a solid green line. Give the matlab code for producing this gure. 16. Suppose in the above plots in 15.), I want to label the axes on the plots, with the horizontal axis labelled as ime (sec)", and the vertical axis in the rst plot elocity (m/sec)", and the vertical axis in the second plot height (m)". Show how to do this.

Explanation / Answer

z = y(2,1). z = 3. You can also specify a range of numbers in a defined vector or ... The colon causes MATLAB to step in sequence through the numbers ... MATLAB has a variety of built-in functions to make it easier for you to .... The floor function rounds its argument to the nearest integer towards negative infinity, e.g. ``down. [PDF] ACADO for Matlab User's Manual - ACADO Toolki

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote