Question: FOUR-Matlab In MATLAB, make a cos(t) function for a time period of 10 seconds with a time step of 0.01. Call it y Find its
FOUR-Matlab In MATLAB, make a cos(t) function for a time period of 10 seconds with a time step of 0.01. Call it y Find its derivative with respect to time. This is the way you find the derivative: z diff(y)/0.01 That should be a -sin(t) function. Plot it using plot(z) in a subplot. In a second subplot, plot a negative sine function. (Use the help function in Matlab to see what a subplot is and how you make it.) Compare the two plots. Are they the same? Try plotting z versus time, t. Do you get an error? Maybe yes. That is expected! Check the sizes of the vectors that you have created: z, y, and t. Investigate "diff" using the help function in Matlab. What does it do? How does it change the length of the vector? Try again and plot z versus t. The end product should be the plot of z (the function you found above) versus time in a subplot next to a plot of negative sine versus time in a subplot next to it. They should look the same. Submit your code, your plots, and your discussion on how "diff works
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
