i need to plot equation w(t) = symsum(dirac(t-k*Ts),k,-Inf,Inf) in discrete time signal.
10 views (last 30 days)
Show older comments
i need to write this equation in matlab and plot them as well as discrete time signal. i already coded them with:
t=-5:0.25:5;
syms k
w(t) = symsum(dirac(t-k*Ts),k,-Inf,Inf);
stem(t,w(t))
but i didnt get the answer
0 Comments
Accepted Answer
檮杌
on 4 Oct 2023
That must be a pulse train with interval of Ts. You need to decide your Ts. An example can be like below.
t=-5:0.25:5;
Ts = 1;
syms k
w = symsum(dirac(t-k*Ts),k,-Inf,Inf);
w = double(w);
idx = w == Inf;
w(idx) = 1;
stem(t,w)
5 Comments
Paul
on 4 Oct 2023
t = -5:0.25:5 does not define a discrete time signal. A discrete-time signal would be of the form
w[n] = ...
where the right hand side depend on n, and n in integer in the range -inf < n < inf.
If w(t) is a continuous-time signal, a discrete-time signal could be formed by sampling
w[n] = w(n*T) where T is a constant.
but sampling continuous-time signals that contain Dirac's may be a tricky business, and probably doesn't make any sense at all in this particular problem if T = Ts.
More Answers (1)
Walter Roberson
on 4 Oct 2023
Dirac delta is a distribution rather than a function.
It can be treated as a distribution in an integration, in which case the integral of C*dirac(X) over an interval is C if the interval includes X and is otherwise 0.
But you are not doing integration, you are doing summation. And when you do summation, the function C*dirac(X) is infinity * sin(C ) if X is exactly equal to 0 in the summation and is otherwise 0.
Hence, the summation w(t) is infinite if t-kTs is exactly 0 anywhere for integer k, and otherwise w(t) is 0. But you cannot plot infinity...
For continuous t and rational Ts then over t from -inf to +inf there would be an infinite number of those infinities. After all, if Ts = p/q for integer p and integer q, then when k becomes a multiple of q, k=r*q then the q would cancel, and k*Ts would be p*r for integer p and r and that would be satisfied when t becomes that p*r . If Ts is irrational then with continuous time you could still satisfy at selected irrational t.
With discrete time over an infinite interval, the p*r logic still works, and if the discrete time is according to a rational frequency you would get infinities with large enough times.
With discrete times over a finite interval (such as you have), there very well might not be any locations where w(t) is infinite... it might well be all zero.
1 Comment
Paul
on 4 Oct 2023
Hi Walter,
I'm not following this statement:
"But you are not doing integration, you are doing summation. And when you do summation, the function C*dirac(X) is infinity * sin(C ) if X is exactly equal to 0 in the summation and is otherwise 0."
In the context of this statement, integration is referring to integration over the independent variable of the signal, but the summation in the Question is not over the independent variable, so I'm not sure why summation is being contrasted against integration. Regardless, where does infinity*sin(C) come from?
See Also
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!