Getting the error “Undefined function 'ilaplace' for input arguments of type 'double'.” when trying to laplace a heaviside function in MATLAB
2 views (last 30 days)
Show older comments
I am trying to solve for the output of a system by taking the laplace transform of a function with a heaviside function. In my code when I have
v = 0.05715*(2*pi/td)*sin(2*pi/td*t)*(heaviside(t))
it works. However, when I change it to
v = 0.05715*(2*pi/td)*sin(2*pi/td*t)*(heaviside(t)-heaviside(t-td))
I can't seem to graph anything because the input V ends up having complex numbers in it and gives the error Undefined function 'ilaplace' for input arguments of type 'double'. Anyone know how to fix this?
% Constants and variables
syms s t
k1 = 12500;
k2 = 87320;
m1 = 84;
m2 = 23;
b1 = 1000;
b2 = 708.6;
td = 0.6652;
pi = 3.1416;
% State space matrices
A = [-b1/m1 b1/m1 1/m1 0; b1/m2 -(b1+b2)/m2 -1/m2 1/m2; -k1 k1 0 0; 0 -k2 0 0];
B = [0; b2/m2; 0; k2];
C = [-b1/m1 b1/m1 1/m1 0];
D = 0
I = [1 0 0 0; 0 1 0 0; 0 0 1 0; 0 0 0 1];
v = 0.05715*(2*pi/td)*sin(2*pi/td*t)*(heaviside(t)-heaviside(t-td)); % input in t domain
V = laplace(v,s) % input in s domain
G = (C*inv(s*I-A)*B*.68 + D)*V % output in s domain
V1 = vpa(ilaplace(G, s, t), 3) % output in t domain
ezplot(V1,[0,1])
0 Comments
Answers (0)
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!