Matlab ilaplace not working properly
4 views (last 30 days)
Show older comments
How can I make matlab return the answer directly and automaticaly?
ilaplace(40/(s*(2*s^3 + s^2 + 6*s + 2)))
% matlab just answers 20 - 40*symsum((exp(t*root(s3^3 + s3^2/2 + 3*s3 + 1, s3, k))*root(s3^3 + s3^2/2 + 3*s3 + 1, s3, k)^2)/(2*(root(s3^3 + s3^2/2 + 3*s3 + 1, s3, k) + 3*root(s3^3 + s3^2/2 + 3*s3 + 1, s3, k)^2 + 3)), k, 1, 3) - 120*symsum(exp(t*root(s3^3 + s3^2/2 + 3*s3 + 1, s3, k))/(2*(root(s3^3 + s3^2/2 + 3*s3 + 1, s3, k) + 3*root(s3^3 + s3^2/2 + 3*s3 + 1, s3, k)^2 + 3)), k, 1, 3) - 20*symsum((exp(root(s3^3 + s3^2/2 + 3*s3 + 1, s3, k)*t)*root(s3^3 + s3^2/2 + 3*s3 + 1, s3, k))/(2*(root(s3^3 + s3^2/2 + 3*s3 + 1, s3, k) + 3*root(s3^3 + s3^2/2 + 3*s3 + 1, s3, k)^2 + 3)), k, 1, 3)
0 Comments
Accepted Answer
Paul
on 24 Nov 2024
Edited: Paul
on 24 Nov 2024
ilaplace can return a closed form, symbolic expression if we give it some help, though it's a bit of a mess. Unclear why it needs such help
syms s
syms t real
F(s) = (40/(s*(2*s^3 + s^2 + 6*s + 2)));
[num,den] = numden(simplify(F(s)));
num,den
num = num/2; den = den/2;
P = solve(den,'MaxDegree',3),disp(char(P))
f(t) = ilaplace(num/prod(s-P));
f(t) = simplify(real(rewrite(f(t),'sincos'))),disp(char(f(t)))
vpa(f(t),2),disp(char(ans))
figure
fplot(f(t),[0 100]),grid
0 Comments
More Answers (1)
Walter Roberson
on 25 Nov 2024
Edited: Walter Roberson
on 25 Nov 2024
syms s
sol = ilaplace(40/(s*(2*s^3 + s^2 + 6*s + 2)))
disp(char(sol))
fullsol = rewrite(rewrite(sol, 'expandsum'), 'expandroot')
disp(char(fullsol))
You can simplify() this, but to be honest the result is more messy.
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!