Question: Write a MATLAB program to do the following: Evaluate the formula over the time range s. Plot h(t) vs t (t on the x-axis and
Write a MATLAB program to do the following:
Evaluate the formula over the time range s.
Plot h(t) vs t (t on the x-axis and h(t) on the y- axis) in a figure window. The plot should be appropriately annotated and have grid lines.
Use an array comparison and indexing to extract the t and h(t) values for the time range s. The t and h(t) values for this range should be stored in variables named tPart and hPart.
Create a second figure window and plot h(t) vs t for the s range. The plot should be appropriately annotated and have grid lines.
Do not evaluate the formula h(t) twice for two different time ranges. Instead, evaluate the formula once for the longer time range and then use a comparison and indexing to extract the time and formula values needed for the second plot.
Annotate your plot with axis labels including units and grid lines. Useful MATLAB functions for creating and annotating plots include: figure, plot, grid, subplot, xlabel, ylabel, title, legend.
Can you please help me solve this on Matlab?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
