Effacer les filtres
Effacer les filtres

problems with using the laplace transform

13 vues (au cours des 30 derniers jours)
Eliraz Nahum
Eliraz Nahum le 28 Déc 2018
Commenté : Star Strider le 30 Déc 2018
hello everyone,
I am trying to plot a system response (y(t)) to an input of u(t)=t*1(t).
The laplace transform of u(t) is U(s)=L{u(t)}= 1/(s^2).
The system is represented in terms of transfer function G(s) = 2/(s^3+5*s^2+4*s+2);
I am trying to create Y(S)=G(s)*U(s) and then convert it to the time domain by ilaplace(Y(s)).
I can't understand why it doesn't work. I get an error:
error.JPG
please help...
clear all
close all
clc
syms t y1(t) s Y1(s)
G_cl_1=2/(s^3+5*s^2+4*s+2);
Y1=G_cl_1*(1/(s^2)); %Finding the Output y(t) while using Laplace Transform
y1=ilaplace(Y1); %Converting Y1(s) to the time space using Opposite Laplace Transform
ezplot (y1)

Réponse acceptée

Star Strider
Star Strider le 28 Déc 2018
First, specify ‘Y1’ and ‘y1’ as functions in your code.
Second, use the vpa function to simplify ‘y1’ so ezplot (or fplot) can plot it.
syms t y1(t) s Y1(s)
G_cl_1=2/(s^3+5*s^2+4*s+2);
Y1(s) = G_cl_1*(1/(s^2)); %Finding the Output y(t) while using Laplace Transform
y1(t) = ilaplace(Y1, s, t); %Converting Y1(s) to the time space using Opposite Laplace Transform
y1 = vpa(y1)
ezplot (y1, [-3 -1])
That works for me. (I specified the limits for ezplot to provide a representative part of the curve. Choose whatever limits you want.)
  2 commentaires
Eliraz Nahum
Eliraz Nahum le 30 Déc 2018
it still doesn't work for me and the results make no sense...
Thanks, I will try to find out what's wrong.
Star Strider
Star Strider le 30 Déc 2018
As always, my pleasure.
Using:
y1 = vpa(y1, 10)
(to make the constants a bit more tractable without losing significant precision), I get:
y1(t) =
t + 0.008162161899*exp(-4.152757602*t) + 1.991837838*exp(-0.423621199*t)*cos(0.5496842464*t) - 0.222527365*exp(-0.423621199*t)*sin(0.5496842464*t) - 2.0
Does that come closer to what you are expecting? To create an anonymous function from it, use the matlabFunction function.
(I am using R2018b. There could be differences with older versions.)

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by