MATLAB Answers

What's the Best Way to Symbolically Define the Periodic Extension of a Finite Duration Signal?

조회 수: 14(최근 30일)
Paul
Paul 2021년 9월 27일 21:27
답변: Paul 2021년 10월 23일 14:44
Suppose I have a finite duration signal:
syms s(t)
s(t) = triangularPulse(0,1,1.5,t);
fplot(s(t))
Now I want to define the periodic extension of this signal from t = -inf to inf. I can extend it over a finite duration. For example, with a period P
syms n P real
assumeAlso(n,'integer');
assumeAlso(P,'positive');
sp(t,P) = symsum(s(t - n*P),n,-5,5)
sp(t, P) = 
fplot(sp(t,3),[-20 20])
And I can evaluate it as well:
sp(1,3)
ans = 
1
But extending to infinity doesn't seem to work so well
sp(t,P) = symsum(s(t - n*P),n,-inf,inf)
sp(t, P) = 
% fplot(sp(t,3),[-20 20]) % code took too long to run
sp(1,3)
ans = 
Is there a way to define a periodic extension that can be evaluated, integrated, etc.? I feel like there should be a way to do it using rem or mod or something similar ....

답변(1개)

Paul
Paul 2021년 10월 23일 14:44
The Symbolic Math Toolbox function mod() changed behavior in 2020b so that (it appears) that such a function can now be easily defined. Link to doc page. I think I was experimenting with mod() in 2019a and that's why it wasn't working for me.
syms s(t)
s(t) = triangularPulse(0,1,1.5,t);
fplot(s(t))
syms P
s_p(t,P) = s(mod(t,P))
s_p(t, P) = 
fplot(s_p(t,2))

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by