inverse Laplace with Matlab

1.5k views Asked by At

I have a problem with finding inverse laplace of function with Matlab. I obtained following transfer function : enter image description here

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 : enter image description here

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?

2

There are 2 answers

0
Matt On BEST ANSWER

There are two things to consider:

  1. By calling poly2sym without a second argument to define the desired variable, x is being used. So poly2sym([1 1]) returns x + 1. Here you want a polynom with variable s, because in ilaplace you state s being the initial variable. Therefore use poly2sym([1 1],s) which will give you s + 1 as result.
  2. Your output with the correction of point (1) is very long and contains unresolved elements like symsum and RootOf which originate from the algorithm behind ilaplace. With the command vpa you can eliminate this and get a numerical result as far as possible.

The code would be something like this:

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,s);             % here the s as second argument
densym=poly2sym(den,s);             % here the s as second argument
transfer=numsym./densym;

timeexp = ilaplace(transfer,s,t);
timenum = vpa(timeexp);             % get numerical answer
pretty(timenum)                     % show the answer in nicer form

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:

timefun = matlabFunction(timenum);
a = linspace(0,1e-4,10000);
plot(a,real(timefun(a)))

This gives the following result: Matlab plot

Compared to WolframAlpha, we can say that our result is definitely plausible.

WolframAlpha plot

0
Royi On

I might be missing something but the inverse transfer function of a Polynomial Function is just the inverse of the ration of polynomials.

Namely, if you have $ F \left( S \right) = \frac{ {P}{1} \left( s \right) }{ {P}{2} \left( s \right) } $ the inverse is given by $ F \left( S \right) = \frac{ {P}{2} \left( s \right) }{ {P}{1} \left( s \right) } $.

What you need to deal with is the zeros of the polynomial at the numerator - This might explain the Delta functions.