Question: Problems 1. Write a MATLAB script m-file that performs the following: Using one line of code and only typing 8 once, create a 5x5 matrix
Problems 1. Write a MATLAB script m-file that performs the following: Using one line of code and only typing "8" once, create a 5x5 matrix called crazy that contains all 8s along its main diagonal (from the top left to the bottom right) and 0s elsewhere. Use a built-in function or operator to rearrange crazy so that the 8s are along the antidiagonal (from the bottom left to the upper right) a. b. 2. Write a MATLAB script m-file that performs the following: Generate a vector x containing 100 evenly spaced values between 0 and 10 (inclusive) a. b. Plot the function y,-e-0.1 x cos(4x) against x as a solid red line. c. On the same graph, plot y21*cos(8x) against x as a dashed green line. d. Title the plot with a descriptive name e. Create a new figure window f. In the new window, plot the following four functions against x using a 2x2 arrangement of subplots. Be sure to label each subplot so we know which subplot contains which function. -e-0.5x cos(4x) y2 ycos(8x) 3. Write a MATLAB seript m-file that performs the following: a. Ask the user to input an amplitude, A, and a frequency, f (in Hz), for a simple sine b. Compute and use fprintf to output the period (in seconds) and angular frequency wave
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
