slow ilapalce calculation for systems with higher polynomial orders

6 views (last 30 days)
Is it possible to calculate the output o(t) of a system h(s) for the input x(s) faster than following codes? Why the following codes run extremely slow? What is wrong?
syms s t
time=linspace(0,4/1e09,401);
h=((5034923382327397*s^3)/627710173538668076383578942320766641610235544446403451289600 + (6766076405664713*s^2)/71362384635297994052914298472474756819137331200 + (210759975314673*s)/64903710731685345356631204115251200 + 376686340223973/281474976710656000000000000)/((5034923382327397*s^3)/12554203470773361527671578846415332832204710888928069025792 + (2284590225627523*s^2)/356811923176489970264571492362373784095686656 + (7512718920571563*s)/649037107316853453566312041152512 + 765850114395651/37778931862957161709568);
x=(100e-03/s)*(1-exp(-s/(2*1e09)))/(1+exp(-s/(2*1e09)));
y=ilaplace(x*h,s,t);
o=subs(y,t,time);
plot(time,o)
  2 Comments
Walter Roberson
Walter Roberson on 6 Feb 2019
your expression for h is either incorrect or meaningless. Numbers with that many digits will be approximated with floating point which will introduce false behaviour with roots and poles in different places than you expect .
Chances are high that you should be using symbolic constants not floating point .
sym('26271892563873553613')
S H
S H on 6 Feb 2019
Thank you Walter. Your suggestion improved my codes but still ilaplace doesn't work. I will open a new thred by resubmitting my revised question.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 6 Feb 2019
subs(vpa(y,16),t,time)
No point in calculating with large numbers to indefinite precision only to throw away that precision since plot() only has single precision resolution according to some tests I have done.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!