Filter löschen
Filter löschen

Plot time continous singal by using a sum of time invariant signals

2 Ansichten (letzte 30 Tage)
Jenny Sundström
Jenny Sundström am 20 Mai 2022
Beantwortet: Chandra am 23 Mai 2022
I want to make a plot of the following:
Where the input x(t) is given as:
and x[n] is the sampled signal of x(t). Below is the code of how I tried to solve it:
f_s = 2,1; Ts = 1/f_s;
t = -5:Ts:5; x = @(t)((3/2) + (3/10) sin(2pit) + sin(2pit/3) - sin(2pit/10)).sinc(t);
syms n
x_t = @(t) symsum(x(n/f_s)sinc((t-nTs)/Ts), n, -5, 5);
x_0 = x_t(t);
plot(x_0, t)
But I can't seem to make it work nor do I understand why. Below are error messages:
Error using symengin Division by zero.
Error in sym/symsum (line 70) rSym = mupadmex('symobj::map',fsym.s,'symobj::symsum',x.s,a.s,b.s);
Error in matlabasklol>@(t)symsum(x(n/f_s)sinc((t-nTs)/Ts),n,-5,5) (line 7) x_t = @(t) symsum(x(n/f_s)sinc((t-nTs)/Ts), n, -5, 5);
Error in matlabasklol (line 8) x_0 = x_t(t);
Would be very grateful for some help or pointers here, many thanks.

Antworten (1)

Chandra
Chandra am 23 Mai 2022
Hi,
Replace the “symsum” function with “for” loop and plot the signal
f_s = 2;
Ts = 1/f_s;
t = -5:Ts:5; % change the the interval of signal like -10:Ts/5:10
x = @(t)((3/2) + (3/10)*sin(2*pi*t) + sin(2*(pi)*t/3) - sin(2*pi*t/10)).*sinc(t);
x_0 = zeros(1,length(t));
for j = 1:length(t)
for i = -6:6
a = x(i)*sinc((j-i*Ts)/Ts);
x_0(j) = a + x_0(j);
end
end
plot(t,x_0)
Refer the below link for further reference about using the sin in degrees and radians

Kategorien

Mehr zu Fourier Analysis and Filtering finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by