A doubt in ZERO PADDING IMPLEMENTATION
5 次查看(过去 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.....
0 个评论
采纳的回答
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 个)
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.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!