Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Error in finding the Laplace transform !!!!

Subject: Error in finding the Laplace transform !!!!

From: Animesh Pandey

Date: 15 Apr, 2011 05:19:05

Message: 1 of 5

clc;
clear all;
syms t w s;
I=sqrt(-1);
f = @(t) exp(-t)*heaviside(t);
H = int(f(t).*exp(-I*w*t), t, -Inf, Inf);
l = int(f(t).*exp(-s*t), t, 0, Inf); % error point
pretty(H);
pretty(l);

w=-8*pi:pi/10:8*pi;
plot(w,subs(H), 'r');
grid

s=-8*pi:pi/10:8*pi;
figure, plot(s, subs(l), 'r');
grid

I am getting an error at the mentioned part ....
I do not wish to use laplace() !
Please help !
Thanks.....

Subject: Error in finding the Laplace transform !!!!

From: Nasser M. Abbasi

Date: 15 Apr, 2011 06:05:48

Message: 2 of 5

On 4/14/2011 10:19 PM, Animesh Pandey wrote:
> clc;
> clear all;
> syms t w s;
> I=sqrt(-1);
> f = @(t) exp(-t)*heaviside(t);
> H = int(f(t).*exp(-I*w*t), t, -Inf, Inf);
> l = int(f(t).*exp(-s*t), t, 0, Inf); % error point
> pretty(H);
> pretty(l);
>
> w=-8*pi:pi/10:8*pi;
> plot(w,subs(H), 'r');
> grid
>
> s=-8*pi:pi/10:8*pi;
> figure, plot(s, subs(l), 'r');
> grid
>
> I am getting an error at the mentioned part ....
> I do not wish to use laplace() !
> Please help !
> Thanks.....

Making life too hard for yourself.

If you want to use laplace, just use laplace.

You are also confusing numerical notations in symbolic expressions.

If you want to explicitly integrate it, you need to
at least tell Matlab that w is in the left side of the plane,
else the integral is not convergent. using assuming w negative...

But why do all this? Just use Laplace:

---------------------------
clc;
clear all;
syms t s w;

I = sqrt(-1);
f = exp(-t)*heaviside(t);
H = laplace(f);

w = -8*pi:pi/10:8*pi;
H = subs(H,s,I*w);

subplot(2,1,1);
plot(w,abs(H), 'r');
title('magnitude');
grid

subplot(2,1,2);
plot(w,angle(H), 'r');
title('phase');
grid
-----------------------------

--Nasser

Subject: Error in finding the Laplace transform !!!!

From: Nasser M. Abbasi

Date: 15 Apr, 2011 06:27:25

Message: 3 of 5

On 4/14/2011 11:05 PM, Nasser M. Abbasi wrote:
> On 4/14/2011 10:19 PM, Animesh Pandey wrote:
>> clc;
>> clear all;
>> syms t w s;
>> I=sqrt(-1);
>> f = @(t) exp(-t)*heaviside(t);
>> H = int(f(t).*exp(-I*w*t), t, -Inf, Inf);
>> l = int(f(t).*exp(-s*t), t, 0, Inf); % error point
>> pretty(H);
>> pretty(l);
>>
>> w=-8*pi:pi/10:8*pi;
>> plot(w,subs(H), 'r');
>> grid
>>
>> s=-8*pi:pi/10:8*pi;
>> figure, plot(s, subs(l), 'r');
>> grid
>>
>> I am getting an error at the mentioned part ....
>> I do not wish to use laplace() !
>> Please help !
>> Thanks.....
>


>
> If you want to explicitly integrate it, you need to
> at least tell Matlab that w is in the left side of the plane,
> else the integral is not convergent. using assuming w negative...
>

Meant to talk about the 's' being less than 1 for the second
integral above. i.e. When you tried this:

        int(f*exp(-s*t), t, 0, Inf)

You need to tell Matlab that magnitude of s is less than
one for the integral to converge.

I do not know how to tell Matlab that. No assumptions I can
find for this.That is why one uses Laplace.

--------------------
EDU>> laplace(f)
1/(s + 1)
----------------

Since laplace takes care of this assumption for you.

In Mathematica, I know how to tell it to assume s is less than
one:

----------------------------
Assuming[Abs[s]<1,
       Integrate[Exp[-t]*HeavisideTheta[t]*Exp[-s*t],{t,0,Infinity}]]

          1/(1+s)

LaplaceTransform[Exp[-t],t,s]
          1/(1+s)
----------------------

That is why I said to use Laplace transform in Matlab instead
of trying to integrate it explicitly.

--Nasser

Subject: Error in finding the Laplace transform !!!!

From: Animesh Pandey

Date: 15 Apr, 2011 08:03:05

Message: 4 of 5

Thank you very much ... !
I also wanted to know that does the sequence of the symbols we write after 'syms' matter .....???

Subject: Error in finding the Laplace transform !!!!

From: Nasser M. Abbasi

Date: 15 Apr, 2011 08:26:24

Message: 5 of 5

On 4/15/2011 1:03 AM, Animesh Pandey wrote:
> Thank you very much ... !
> I also wanted to know that does the sequence of the symbols we write
> after 'syms' matter .....???

I am not sure I undestand. But

syms x y z

tells matlab that x y z are symbolic variables.

--Nasser

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us