Matlab results not matching theory

9 visualizaciones (últimos 30 días)
Bruce Pollom
Bruce Pollom el 4 de En. de 2018
Comentada: Bruce Pollom el 5 de En. de 2018
clear all;
clc;
Fs = 1000;
Ts = 1/Fs;
t=-1:Ts:1;
%u(t-0.5)
step = zeros(size(t));
step(t>=0.5) = -1;
figure
grid
plot(t,step)
%u(t+0.5)
step2 = zeros(size(t));
step2(t>=-0.5)= 1;
figure
grid
plot(t,step2)
xt=step2+step;
figure
plot(t,xt)
y = conv(xt,xt);
t3 = -2 :Ts:2;
figure
plot(t3,y)
z = conv (y,xt );
t4= -3:Ts:3;
figure
plot(t4,z)
q = conv(z,xt)
t5 = -4:Ts:4
figure
plot(t5,q)
nfft=length(y)*32;
Y = fft(y,nfft);
Y = fftshift(Y);
F=-Fs/2:Fs/nfft:Fs/2-Fs/nfft;
figure
plot(F,abs(Y))
nfft=length(z)*32;
Z=fft(z,nfft);
Z=fftshift(Z);
F=-Fs/2:Fs/nfft:Fs/2-Fs/nfft;
figure
plot(F,abs(Z))
nfft=length(q)*32;
Q=fft(q,nfft);
Q=fftshift(Q);
F=-Fs/2:Fs/nfft:Fs/2-Fs/nfft;
figure
plot(F,abs(Q))
So I have this code, but for the 2nd convolution and 3rd one ( z and q ) the theory shows different results . Is there something wrong in my code or should I recheck the theory and redo it ?
  4 comentarios
Image Analyst
Image Analyst el 5 de En. de 2018
Editada: Image Analyst el 5 de En. de 2018
What do you expect the base signal to look like? A square pulse? A negative pulse on the left and positive pulse on the right? I still don't know why you're tacking numbers onto the ends!
Bruce Pollom
Bruce Pollom el 5 de En. de 2018
The base signal looks good, and the first convolution aswell. My problem is at the 2nd convolution where I get a concave portion followed by a convex one in the middle and a concave one on the right but I get the opposite in theory. And what do you mean by tacking numbers onto the ends ?

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Mathematics en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by