step and impulse response of a system
8 views (last 30 days)
Show older comments
i have a question which is the following:
impulse respone of a system is h(t) =( exp(-0.05*t) )
Excitation of a system is x(t) = u(t)*cos(2*pi*t)
1-in subplot 1 show the impulse respone of the system
2-in subplot 2 show the Excitation of the system
3-in subplot 3 show the response of the system
4-in subplot 4 show the step response of the system
where t range is from 0...100
code:
t = 0:100;
u = heaviside(t);
impulse = [];
excitation = [];
for i =1:numel(t)
impulse(i)= exp(-0.05*t(i));
end
for i =1:numel(t)
excitation(i) = u(i).*cos(2.*pi.*t(i));
end
subplot(2,2,1)
plot(t,impulse)
title('impulse response')
subplot(2,2,2)
plot(t,excitation)
title('excitation')
c = conv(excitation,impulse,"same");
subplot(2,2,3)
plot(t,c)
title("Response")
step = conv(u,impulse,"same");
subplot(2,2,4)
plot(t, step)
title("Step Response")
i'm not sure that the solution is correct because i'm getting the response of the system and step response figure both the same, so any ideas whether the solution is good or no?
0 Comments
Answers (1)
Bhavana Ravirala
on 16 Nov 2022
Edited: Bhavana Ravirala
on 22 Feb 2023
Hi,
I understand that you are trying to plot step and impulse response of the system. As the range of ‘t’ is from 0 to 100 you can use “linspace” command. By using these ‘t’ values we will get proper cos signal. And for loops are not required to generate impulse and excitation signals.
t=linspace(0,100); % getting the t values from the linspace command
u=heaviside(t);
excitation=u.*cos(2*pi.*t);
impulse=exp(-0.05*t);
subplot(2,2,1)
plot(t,impulse)
title('impulse response')
subplot(2,2,2)
plot(t,excitation)
title('excitation')
c = conv(excitation,impulse,"same");
subplot(2,2,3)
plot(t,c)
title("Response")
step = conv(u,impulse,"same");
subplot(2,2,4)
plot(t, step)
title("Step Response")
0 Comments
See Also
Categories
Find more on Spectral Measurements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!