Plotting responses other than step responses to transfer function
12 views (last 30 days)
Show older comments
I am trying to plot the response of a transfer function to an arbitrary input. The step response can be plotted as shown below.
T = tf(164.6,[1 13 32 184.6])
step(T)
The step response plot is a plot of the inverse Laplace of 1/s * tf(164.6,[1 13 32 184.6]) , but trying to plot this directly without the step function using the command
syms s
T = tf(164.6,[1 13 32 184.6])
fplot(ilaplace(1/s*poly2sym(T.Numerator{:},s)/poly2sym(T.Denominator{:},s)))
generates a blank plot. Is there a way
to plot the response directly without using the step function that would allow you to plot the response to any input?
0 Comments
Answers (1)
Paul
on 10 Apr 2021
Edited: Paul
on 10 Apr 2021
Looks like an fplot() confusion issue. This code results in the expected plot:
>> syms t; y(t) = ilaplace(1/s*poly2sym(T.Numerator{:},s)/poly2sym(T.Denominator{:},s));
>> plot(0:.01:9,double(y(0:.01:9)))
However, the result of that ilaplace() operation results in fairly complicated expression in terms of roots(). So this approach might not be practical for even moderately complicated systems.
A partial fraction approach may be feasible to get a cleaner representation of y(t):
syms s t
T(s) = 164.6/(s^3 + 13*s^2 + 32*s + 184);
U(s) = 1/s;
Y(s) = U(s)*T(s);
Y(s) = partfrac(Y(s),'FactorMode','real');
y(t) = sum(real(ilaplace(children(Y(s)))));
For the response of an LTI system to an arbitrary input specificed in the time domain, check out:
doc lsim
If the input is speicified in terms of its Laplace transform, then the output can be plotted with
impulse(T*U)
where U is the Laplace transform of u(t) (expessed in tf or zpk form, most typically).
Sometimes it's best to take advantage of the linearity of LTI systems: break the input up into a sum of simpler inputs, get the output to each simple input, and then sum those ouputs to get the system output to the original input.
0 Comments
See Also
Categories
Find more on Calculus 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!