diffrent plots if I add the command assume (0<=t) why ?

조회 수: 1 (최근 30일)
tomer polsky
tomer polsky 2022년 7월 23일
댓글: tomer polsky 2022년 7월 23일
so I want to get laplace transform of f(t)=cos(12t)*exp(-0.4t). the strange this is that if add the command : assume (0<=t) I get the right laplace transform but the plot of f(t) is not starting from zero ,but insted start from -20 . hot to fix this problem ?
clc;clear all;
syms t
assume(0<=t);
f_t3 = piecewise(0<=t,cos(12*t)*exp(-0.4*t));
f_s3=laplace(f_t3);
pretty(f_s3)
fplot(f_t3,[-20 20]);
but if I write the same code but with out assume(0<=t) I get the right plot but not the right laplce transform of f(t) .
clc;clear all;
syms t
f_t3 = piecewise(t<0,0,0<=t,cos(12*t)*exp(-0.4*t));
f_s3=laplace(f_t3);
pretty(f_s3)
fplot(f_t3,[-20 20]);

답변 (2개)

Walter Roberson
Walter Roberson 2022년 7월 23일
assume(0<=t);
You solemnly swear that t will never be complex or negative
fplot(f_t3,[-20 20]);
but you make t negative down to -20 anyhow.
  댓글 수: 2
Paul
Paul 2022년 7월 23일
Let me see if I understand this correctly
syms t
assume(0<=t);
f_t3 = piecewise(0<=t,cos(12*t)*exp(-0.4*t))
f_t3 = 
So the piecewise is simplified away due to the assumption. laplace() works fine on f_t3. But then fplot() comes along and basically does a subs type of thing over [ -20 20 ] w/o caring about the assumption.
In the second case, fplot has no reason not to work, but laplace() and piecewise() just don't play nice together. I'm not quite sure why that has to be the case, but I'm really not suprised.
Is that about right?
tomer polsky
tomer polsky 2022년 7월 23일
thank you

댓글을 달려면 로그인하십시오.


Paul
Paul 2022년 7월 23일
I suggest getting in the habit of using heaviside for problems like this
syms t
f_t3 = cos(12*t)*exp(-0.4*t)*heaviside(t);
f_s3=laplace(f_t3)
f_s3 = 
fplot(f_t3,[-20 20]);

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by