step and impulse response of a system

7 次查看(过去 30 天)
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?

回答(1 个)

Bhavana Ravirala
Bhavana Ravirala 2022-11-16
编辑:Bhavana Ravirala 2023-2-22
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")

类别

Help CenterFile Exchange 中查找有关 Spectral Measurements 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by