I have a problem with finding inverse laplace of function with Matlab. I obtained following transfer function :
I tried methods like
syms s t;
num=[0 0 0 1.658e24 -1.163e14 6.076e15];
den=[1 3.334e09 1.005e15 1.675e24 5.025e27 1.675e33];
numsym=poly2sym(num);
densym=poly2sym(den);
transfer=numsym./densym;
ilaplace(transfer,s,t)
but did not get an acceptable result. Meaning Matlab simply returns :
Also I tried to use partial fraction expansion and I wrote transfer function respect to poles and zeros but when I added all the pieces I did not get the original transfer function.
syms s t;
num=[0 0 0 1.658e24 -1.163e14 6.076e15];
den=[1 3.334e09 1.005e15 1.675e24 5.025e27 1.675e33];
numsym=poly2sym(num);
densym=poly2sym(den);
transfer=numsym./densym;
[z,p,r]=residue(num,den);
transfer1=(z(1)/(s-p(1)))+(z(2)/(s-p(2)))+(z(3)/(s-p(3)))+(z(4)/(s-p(4)))+(z(5)/(s-p(5)));
transfer1=vpa(simplifyFraction((transfer1),'Expand',true),2)
the
The transfer1 variable after simplification is order 4 in numerator while the original transfer function is order 2. I would be very thankful if anyone help me to find the transfer function of following expression by any method?
There are two things to consider:
poly2sym
without a second argument to define the desired variable,x
is being used. Sopoly2sym([1 1])
returnsx + 1
. Here you want a polynom with variables
, because inilaplace
you states
being the initial variable. Therefore usepoly2sym([1 1],s)
which will give yous + 1
as result.symsum
andRootOf
which originate from the algorithm behindilaplace
. With the commandvpa
you can eliminate this and get a numerical result as far as possible.The code would be something like this:
Now we can verify the answer in case you think this might be just a bunch of numbers. Therefore a comparison with WolframAlpha is helpful. We need to convert the symbolic expression to a function handle to plot the results:
This gives the following result:
Compared to WolframAlpha, we can say that our result is definitely plausible.