[英]Upsampling and plotting a frequency domain signal
I want to upsample by 5 a signal in frequency domain, and then plot (stem) it. 我想在频域中对信号进行5倍采样,然后绘制(词干)。 I figured how to upsample,
我想出了如何升采样,
Fk=(1/5)*upsample(ak_new,5);
now this creates a vector that is 5 times bigger than the original one, and I need to take the inverse Fourier series of this signal 现在,这将创建一个比原始矢量大5倍的矢量,我需要对该信号进行傅立叶逆级数
Fn=(Fk*(exp((1i*2*pi/N*n'*n))));
where n
is a sample vector (-1000:1000)
, as you can see, I can't make the transformation since n
is not the same size as Fk
anymore. 如您所见,其中
n
是样本矢量(-1000:1000)
,由于n
与Fk
不再相同,因此无法进行转换。 How can I solve this? 我该如何解决?
You need to plot your upsampled signal in frequency domain, on a similarly "upsampled" frequency vector. 您需要在相似的“上采样”频率向量上,在频域中绘制上采样信号。
If your initial frequency vector was -1000, -999, -998 ...
, now it should be -1000, -999.8, -999.6
. 如果您的初始频率向量是
-1000, -999, -998 ...
,现在应该是-1000, -999.8, -999.6
。
Here is a simple example: 这是一个简单的示例:
Fs = 2000; % Sampling frequency
T = 1/Fs; % Sampling period
L = 2000; % Length of signal
t = (0:L-1)*T; % Time vector
S = sin(2*pi*400*t); % Signal
Y = fft(S);
ak_new = fftshift(abs(Y/L)); % Initial signal in frequency domain
Fk = upsample(ak_new,5); % Upsampled signal
f = (Fs/L)*(-L/2: 1 :L/2-1); % Initial frequency vector
fup = (Fs/L)*(-L/2:(1/5):L/2-1/5); % Upsampled frequency vector
subplot(2, 1, 1);
stem(f, ak_new);
title('Before upsampling');
subplot(2, 1, 2);
stem(fup, Fk);
title('After upsampling');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.