Ramp/step response of LTI system not matching up
조회 수: 2 (최근 30일)
이전 댓글 표시
So i know this is a rather useless bunch of code but these two examples should match each other and they are not
Obviously if you have an LTI system and you get the ramp response of the system and take the derivative of that , that is equal to the step response. Taking the derivative of the step gets you the impulse.
Im trying to prove that the plot is correct in matlab
The only difference in the code is the top version defines the ramp step and impulse directly. Version 2 takes its derivative
syms s
system1_tf_sym = 5/(5*s^2 + s + 5)
system_1_ramp_response = (1/s^2)*system1_tf_sym
system_1_step_response = (1/s)*system1_tf_sym
system_1_impulse_response = system1_tf_sym
system_1_ramp_response_inverse = ilaplace(system_1_ramp_response)
system_1_step_response_inverse = ilaplace(system_1_step_response)
system_1_impulse_response_inverse = ilaplace(system_1_impulse_response)
x1= ezplot(system_1_ramp_response_inverse,[ 0 60 -1 8])%simple plot that allows the function to be plotted without an x axis defined upfront
set(x1,'color',[1 0 0]) %setting the color on the second plot so its readable
hold on
y1= ezplot(system_1_step_response_inverse,[ 0 60 -1 8])%simple plot that allows the function to be plotted without an x axis defined up front
set(y1,'color',[0 1 0]) %setting the color on the second plot so its readable
hold on
z1= ezplot(system_1_impulse_response_inverse,[ 0 60 -1 8])%simple plot that allows the function to be plotted without an x axis defined up front
set(z1,'color',[0 0 1]) %setting the color on the second plot so its readable
Now if i run this i get the result I'm after and all is well. Im not taking a derivative here I'm just simply defining the fact that the the tf multiplied by 1/s^2 = ramp and 1/s = step and 1 equals impulse
I get the correct plot with this
Now this next bit of code should yield the same result but it does not and i don't know why. Can someone please tell me why the result is not the same?
syms s
system1_tf_sym = 5/(5*s^2 + s + 5)
system_1_ramp_response = (1/s^2)*system1_tf_sym
%NEXT TWO LINES ARE THE ONLY DIFFERENCE
system_1_step_response = diff(system_1_ramp_response,s)
system_1_impulse_response = diff(system_1_step_response,s)
%end different lines
system_1_ramp_response_inverse = ilaplace(system_1_ramp_response)
system_1_step_response_inverse = ilaplace(system_1_step_response)
system_1_impulse_response_inverse = ilaplace(system_1_impulse_response)
x1= ezplot(system_1_ramp_response_inverse,[ 0 60 -1 8])%simple plot that allows the function to be plotted without an x axis defined upfront
set(x1,'color',[1 0 0]) %setting the color on the second plot so its readable
hold on
y1= ezplot(system_1_step_response_inverse,[ 0 60 -1 8])%simple plot that allows the function to be plotted without an x axis defined up front
set(y1,'color',[0 1 0]) %setting the color on the second plot so its readable
hold on
z1= ezplot(system_1_impulse_response_inverse,[ 0 60 -1 8])%simple plot that allows the function to be plotted without an x axis defined up front
set(z1,'color',[0 0 1]) %setting the color on the second plot so its readable
댓글 수: 2
Mischa Kim
2016년 10월 13일
Robert, what lets you believe that the results are not matching up? Are you comparing the plots and they are different?
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!