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

6 views (last 30 days)
Paul
Paul on 27 Sep 2021
Answered: Paul on 23 Oct 2021
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 ....

Answers (1)

Paul
Paul on 23 Oct 2021
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))

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!