Question
%Generate t vector between 0 and 20 using increase of 0.01 t = 0:0.01:20; % Calculate h(t) according to the formula % Evaluate h(t) h
%Generate t vector between 0 and 20 using increase of 0.01
t = 0:0.01:20;
% Calculate h(t) according to the formula
% Evaluate h(t)
h = 4.0 + 6.0 .* t. * exp(-0.5.*t) - 4.0 .* exp(-0.25.*t) * cos(0.75.*pi.*t);
% Plot h(t) vs t
figure;
plot(t,h);
xlabel('t (s)');
ylabel('h(t)');
title('h(t) vs t');
grid on;
% Extract h(t) and t values for 5
tPart = t(t >= 5 & t
hPart = h(t >= 5 & t
% Plot h(t) vs t for 5
figure;
plot(tPart, hPart);
xlabel('t (s)');
ylabel('h(t)');
title('h(t) vs t for 5
grid on;
Here is what I did , the h and hPart are incorrect ,maybe it's the way that I wrote the h(t).Can you please help me?
Write a MATLAB program to do the following: 1. Evaluate the formula h(t)=4.0+6.0te0.5t4.0e0.25tcos(0.75t) over the time range 0.0t20.0s. 2. 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. 3. Use an array comparison and indexing to extract the t and h(t) values for the time range 5.0t12.0s. The t and h(t) values for this range should be stored in variables named tPart and hPart. 4. Create a second figure window and plot h(t) vs t for the 5.0t12.0s range. The plot should be appropriately annotated and have grid lines. 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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started