A doubt in ZERO PADDING IMPLEMENTATION

1 次查看(过去 30 天)
actually i am applying short time fourier transform and i am implementing zero's to the end of the signal to match with the window length but i can see some artifacts in my plot with less power how can i avoid it can i avoid it by applying zeros between the signal like ex: 102030..... how can i do it.....

采纳的回答

Image Analyst
Image Analyst 2012-1-28
Not sure I follow why you're trying to do this, but here is code for interleaving zeros in your array:
m = rand(1,10); % Sample data.
interleaved = zeros(1, 2*length(m));
interleaved(1:2:end) = m
  1 个评论
raj
raj 2012-1-28
I wanted to do this because when I add zeros to the nd of my signal I have some artifacts generated on my spectrogram so I wanted to try by adding zeros this way

请先登录,再进行评论。

更多回答(1 个)

Wayne King
Wayne King 2012-1-29
Raj, You don't want to insert zeros as you have done. That is called upsampling by two. Upsampling by two contracts the spectrum of the input signal by a factor of two and results in imaging artifacts.
As a simple example:
n = 0:99;
x = cos(pi/2*n);
y = upsample(x,2);
xdft = fft(x);
xdft = xdft(1:length(x)/2+1);
freq = 0:(2*pi)/length(x):pi;
plot(freq,abs(xdft));
hold on;
freq1 = 0:(2*pi)/length(y):pi;
ydft = fft(y);
ydft = ydft(1:length(y)/2+1);
plot(freq1,abs(ydft),'r');
set(gca,'xtick',[pi/4 pi/2 3*pi/4])
The original sine wave at pi/2 radians/sample has contracted to pi/4 radians/sample and a new "image" has appeared at 3*pi/4.

类别

Help CenterFile Exchange 中查找有关 Time-Frequency Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by