Input and output of transfer function in matlab

Version 1.0.0 (54.3 KB) by Sri
A transfer function of a system, sub-system, or component is a mathematical function that models the system's output for each possible input
7 Downloads
Updated 18 Apr 2024

View License

M=2;
b=14;
q=20;
num=[1];
G=tf(num,[M b q]);
syms t
F = 2*(heaviside(t)-heaviside(t-2));
T = linspace(0, 3);
sympref('HeavisideAtOrigin', 0);
u = double(subs(F, t, T));
y1 = lsim(G, u, T);
sympref('HeavisideAtOrigin', 1);
u = double(subs(F, t, T));
y2 = lsim(G, u, T);
syms s
y3 = ilaplace(1/(M*s^2 + b*s + q)*(2/s - 2*exp(-2*s)/s),s,t);
y3 = double(subs(y3,t,T)).';
plot(T,y1,T,y2,T,y3,'o')
legend('HeavisdeOrigin = 0','HeavisdeOrigin = 1','exact','Location','South')

Cite As

Sri (2024). Input and output of transfer function in matlab (https://www.mathworks.com/matlabcentral/fileexchange/163926-input-and-output-of-transfer-function-in-matlab), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2024a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.0.0