why cannot I get the figure by ezplot?
Show older comments
Dear all,
I wrote a program to plot the inverse laplace transform of a function wks, matlab can calculate it fast. But it is always busy and cannot give me the figure. Please help me with the problem! Thank you very much! The following is my code.
syms s
expositive=(s+sqrt(s^2+1))^2;
exnegative=1/expositive;
zt=1/(2*s); z2=1/(2*s);
n2=(zt-z2*(expositive-exnegative)/2)/(zt+z2*(expositive-exnegative)/2);
wks=2*(1-exnegative)/(expositive-exnegative)*(exnegative^4+n2*exnegative^5)/(1+n2*exnegative^10);
wkt=ilaplace(sym('wks'));
display('calculation finished')
ezplot(wkt,[0,100])
Answers (2)
Walter Roberson
on 26 Jan 2012
wkt = ilaplace(wks);
Otherwise the calculated wks value from the previous expression will not be used.
3 Comments
Shuang
on 26 Jan 2012
Walter Roberson
on 26 Jan 2012
"Error in inline expression" is not very specific unfortunately.
When I ask Maple to ilaplace wks, it complains of a division by 0. The reason for that is not clear to me. It could be, though, that your expression is running in to the equivalent of that division by 0.
Your wks has a lot of sqrt(s^2+1) and thus is not a polynomial or rational function of polynomials. Maple only promises to be able to do the transform for polynomials or rational functions of polynomials, but does know some other selected cases as well. It appears that it is not able to handle your situation.
Shuang
on 26 Jan 2012
Shuang
on 26 Jan 2012
0 votes
1 Comment
Walter Roberson
on 26 Jan 2012
I confirm that the simplification is valid.
I do not know why the message about cell elements is produced.
As an experiment try
wtknF = matlabFunction(vpa(wkt));
t = linspace(0,100,250); %250 is number of points you want
plot(t, wtknF(t))
Categories
Find more on Polynomials 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!