A doubt in ZERO PADDING IMPLEMENTATION

조회 수: 2 (최근 30일)
raj
raj 2012년 1월 28일
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