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?
댓글 수: 0
답변 (1개)
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")
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Spectral Measurements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!