I want to upsample by 5 a signal in frequency domain, and then plot (stem) it. 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
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. 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
.
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');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.