Step response with initial condition
Show older comments
How to obtain a step response starting from 10?
ie; the initial value of u_del is 10. Hence the response should start from 10.
k=0.2;
t2=400;
u_del=(0.0022*k*(s+0.06931)*(s^2+0.4852*s+0.1492))/((s+0.04833)*(s+0.004352)*(s^2+0.06012*s+0.01331));
figure
step(u_del,t2);
ylabel('Velocity,u (m/s)','fontsize',10);
title('Time Response');
grid
Answers (2)
Star Strider
on 19 Apr 2021
To set the step amplitude to 10, try this:
k=0.2;
t2=400;
s = tf('s');
u_del=(0.0022*k*(s+0.06931)*(s^2+0.4852*s+0.1492))/((s+0.04833)*(s+0.004352)*(s^2+0.06012*s+0.01331));
opts = stepDataOptions('StepAmplitude',10); % Set Amplitude
figure
step(u_del,t2,opts); % Add ‘opts’ Argument
ylabel('Velocity,u (m/s)','fontsize',10);
title('Time Response');
grid
.
4 Comments
Drishya Dinesh
on 19 Apr 2021
Star Strider
on 19 Apr 2021
My pleasure!
step always applies the step input at t = 0, regardless of Ti.
k=0.2;
t2=400;
s = tf('s');
u_del=(0.0022*k*(s+0.06931)*(s^2+0.4852*s+0.1492))/((s+0.04833)*(s+0.004352)*(s^2+0.06012*s+0.01331));
Ts = 1; % Time Step (sec)
tv = linspace(0, 400, fix(400/Ts))*Ts; % Time Vector
u = tv>10; % Unit Step Input Starting AT t=10 sec
% [y,t] = lsim(u_del, u, tv); % Outputs (If Desired)
figure
lsim(u_del, u, tv) % Simulate System & Plot
ylabel('Velocity,u (m/s)','fontsize',10);
title('Time Response');
grid k=0.2;
t2=400;
s = tf('s');
u_del=(0.0022*k*(s+0.06931)*(s^2+0.4852*s+0.1492))/((s+0.04833)*(s+0.004352)*(s^2+0.06012*s+0.01331));
Ts = 1; % Time Step (sec)
tv = linspace(0, 400, fix(400/Ts))*Ts; % Time Vector
u = tv>10; % Unit Step Input Starting AT t=10 sec
% [y,t] = lsim(u_del, u, tv); % Outputs (If Desired)
figure
lsim(u_del, u, tv) % Simulate System & Plot
ylabel('Velocity,u (m/s)','fontsize',10);
title('Time Response');
grid
That works correctly, at least as I understand what you want to do. If you want a different amplitude than 1 for the input, multiply ‘u’ by that value. If you want a different version of the step input, please be specific.
Drishya Dinesh
on 19 Apr 2021
Star Strider
on 19 Apr 2021
When I first tried to run your code, it threw:
Unrecognized function or variable 's'.
so I added the tf call, since that makes sense in the context of the Control System Toolbox, and the posted code.
I cannot guess as to what the exact problem is, only that ‘tf’ appears to have been assigned as a vector or other variable in code you did not post, and MATLAB is interpreting the 's' as the ASCII numeric equivalent, and throwing that error. The unposted code therefore overshadowed the very useful tf function with something else.
Ignore whatever exists before my posted code and run only my code as I posted it to get the desired result.
My posted code runs without error.
Paul
on 20 Apr 2021
0 votes
According to the question, the output should satisfy y(t=0) = 10. But the system, u_del, as specified will yield a step response that starts at y(t=0) = 0, in the absence of any initial conditions on the states of the system. So the next question is: what causes the step response to start at y(t=0) = 10? If it is initial conditions on the states of the system, then we have to use a state space representation for u_del, and even then there will be different initial conditions on states that will result in an initial output y(t=0) = 10 but different dynamics for y(t).
2 Comments
Drishya Dinesh
on 20 Apr 2021
Paul
on 20 Apr 2021
One of many, many possibilities would be:
>> u_delss=ss(u_del);
>> x0=[10/u_delss.c(1) 0 0 0];
>> t = 0:1:t2;
>> y = step(u_delss,t) + lsim(u_delss,0*t,t,x0);
>> plot(t,y,t(1:10:end),y(1:10:end),'o'),grid
Probably doesn't give the response you're looking for, but it is the response of the system u_delss to a unit step input with initial conditions x0 that result in y(t=0) = 10.
Did you just want something simple like:
[y,t] = step(u_del);
plot(t,y+10),grid
Note that this isn't the step response of u_del.
Categories
Find more on Time and Frequency Domain Analysis 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!