在此代码中,f1和f2是门和脉冲列的傅里叶变换。 我需要这两个光谱之间的卷积图
我期待着一系列sinc函数,因为一个脉冲串的信号卷积给了那个函数的列车..
但是使用直接conv()我得到一个正的正弦脉冲...
fSampling = 10000; %Sampling Frequency
tSampling = 1/fSampling; %Sampling Time
L = 10000; %Length of Signal
to = (0:L-1)*tSampling; %Time Vector
F = 100;
% message signal
t = -5:0.01:5;
w=1;
a= rectpuls(t,2);
subplot(2,4,1);
plot(t,a);
xlabel('Time');
ylabel('Amplitude');
title('Message signal');
grid on;
% Fourier transform of sine wave
subplot(2,4,2)
NFFT = 2^nextpow2(L);
Xsig = fft(a,NFFT)/L;
f1 = fSampling/2*(linspace(0,1,NFFT/2+1));
plot(f1,2*abs(Xsig(1:NFFT/2+1)),'r');
grid on;
axis([-50 500 1.0000e-005 1])
title('\itSignle-Sided Amplitude Sepectrum of xsig(t)');
xlabel('\itFrequency(Hz) \rightarrow');
ylabel('|Xsig(f)| \rightarrow');
% train of impulse
n= -5:1:5;
l =length(n);
for i= 1:l
x(i)=1;
end;
subplot(2,4,3);
stem(n,x);
xlabel('Time');
ylabel('Amplitude');
title('Train of Impulses');
grid on;
% Fourier Transform of Train of Impulse
subplot(2,4,4)
NFFT = 2^nextpow2(L);
Xsig = fft(x,NFFT)/L;
f2 = fSampling/2*(linspace(0,1,NFFT/2+1));
stem(f2,2*abs(Xsig(1:NFFT/2+1)),'r');
grid on;
axis([-50 500 1.0000e-005 1])
title('\itSignle-Sided Amplitude Sepectrum of xsig(t)');
xlabel('\itFrequency(Hz) \rightarrow');
ylabel('|Xsig(f)| \rightarrow');
% multiplication of signals
T = -5:0.01:5;
b = a.*x(i);
subplot(2,4,5);
stem(T,b);
xlabel('Time');
ylabel('Amplitude');
title('Sampled signal');
grid on;
% Fourier transform of Sampled Signal
subplot(2,4,6)
NFFT = 2^nextpow2(L);
Xsig = fft(x,NFFT)/L;
f3 = fSampling/2*(linspace(0,1,NFFT/2+1));
plot(f3,2*abs(Xsig(1:NFFT/2+1)),'r');
grid on;
axis([-50 500 1.0000e-005 1])
title('\itSignle-Sided Amplitude Sepectrum of xsig(t)');
xlabel('\itFrequency(Hz) \rightarrow');
ylabel('|Xsig(f)| \rightarrow');
%Convolution of
c= conv(f1,f2)
subplot(2,4,7);
plot(c);
grid on;