How to get Fourier transform of rectangular window as shown by wvtool function?. Why frequency domain of rectwin(M) using fft and wvtool are different?

rectangular window rectwin(M) is plotted in time domain and freuquency domain using wvtool.
But when I take fft of rectwin(M), it is giving the below result.
How to get the frequency domain as shown by wvtool?
WHy frequency domain of rectwin(M) using fft and wvtool are dfifferent?

 Accepted Answer

It looks like wvtool is plotting the DTFT of rectwin(M)
[h,w] = freqz(rectwin(64),1);
figure
plot(w,db(abs(h)))
The DFT (as computed by fft() ), should be nonzero only at DC, and it is.
figure;
stem((0:63)/64*2*pi,abs(fft(rectwin(64))))
xlim([-0.1 2*pi])
How did you make your FFT plot?
As must be the case, the elements of the DFT are samples of the DTFT, as shown here plotted in absolute magnitude, not dB
figure
plot(w,(abs(h)))
hold on;
stem((0:63)/64*2*pi,abs(fft(rectwin(64))))
xlim([-0.1 pi])

4 Comments

Thanks Paul for the answer. Solved my problem. But I still have a doubt.
So If I have taken an arbitrary function and multiplied it with a rectangular function of length equal to it.
Taking the fft of the result, will the result be like the circular convolution of fft of respective individual sequences (or) circular convolution of dft of rsepective individual sequences?
See the following image (90*45 dimension), which is the ifft of a sequence E_HH
Now I multiplied E_HH and two dimensional rectangular window of equal length (90*45 dimension). The ifft of this result came like this figure (90*45 dimension).
The above figure looks like the circular convolution of figure 1 and the dft of rectangular window (90*45 dimension). As we have taken ifft, the result should be the convolution of figure 1 and the fft of rectangular window (90*45 dimension). But its not. Why?
Also I want to circular convolve the result and and dft of rectangular window (90*45 dimension) to see if figure 2 comes as result. But I don't know how to compute two dimensional dft. I thick 'freqz' works only for 1 dimension.
So If I have taken an arbitrary function and multiplied it with a rectangular function of length equal to it.
If I'm understanding this statement, you have a finite length sequence of, for example, 64 values. And then it is element-wise multiplied with rectwin(64)? Doesn't that just result in the original sequence?
Taking the fft of the result, will the result be like the circular convolution of fft of respective individual sequences (or) circular convolution of dft of rsepective individual sequences?
For two finite length sequences, the DFT of their product should be the circular convolution of their DFTs
x = [1 2 3];
y = [4 5 6];
z = x.*y;
format short e
[fft(z);
cconv(fft(x),fft(y),numel(x))/numel(x)]
ans =
3.2000e+01 + 0.0000e+00i -1.0000e+01 + 6.9282e+00i -1.0000e+01 - 6.9282e+00i 3.2000e+01 + 0.0000e+00i -1.0000e+01 + 6.9282e+00i -1.0000e+01 - 6.9282e+00i
The fft() function computes the DFT, so circular convolution of the outputs of the fft() for each sequence is the circular convolution their DFTs.
As for the pictures, can you post your code with a simple, smaller example, that can be run as-is w/o loading data from a file? I'm not quite following what's going on there. You may want to post that as a new question, because it's not really related to this question and it may get more attention from folks who do 2D processing.
But I don't know how to compute two dimensional dft.
doc fft2
I thick 'freqz' works only for 1 dimension.
That is correct, freqz() is only for one dimension. But I was using freqz() to compute the DTFT of a sequence, and it sounds like you want to use the DFT for your processing, in which case, fft2()/ifft2() are the way to go.
Thanks or answering paul.
I meant, Taking the fft of the result, will the result be like the circular convolution of fft of respective individual sequences (or) circular convolution of dtft of rsepective individual sequences?
Wrongly typed as dft instead of dtft.
I will post it as another question.
Here's the code used for the figures.
E_HH has the original data.
r=rectwin(90)*rectwin(45).';
figure
E_HH = E_HH.*r;
ISAR_HH = abs(fftshift(ifft2(E_HH.')));
ISAR_HHdB = 20*log10(ISAR_HH);
imagesc(X,Y,ISAR_HHdB);
grid on; colormap(hot)
caxis([max(max(ISAR_HHdB))-rd,(max(max(ISAR_HHdB)))]);
axis xy; axis equal; axis tight;
set(gca,'FontName', 'Arial', 'FontSize',12,'FontWeight', 'Bold');
xlabel('\itrange, m');
ylabel('\itx-range, m');
title('\itISAR Image (VV Polarization)');
cc = colorbar;
tt = title(cc,'dBsm');
tt.Position = [ 8 -15 0 ];
Still curious about this
E_HH = rand(90,45) + 1j*rand(90,45);
r = rectwin(90)*rectwin(45).';
isequal(E_HH,E_HH.*r)
ans = logical
1
So mutiplying E_HH by r should not have an effect on the results. But the images above are not the same, so there must be some other difference in the processing the led to those images.

Sign in to comment.

More Answers (0)

Categories

Find more on Fourier Analysis and Filtering in Help Center and File Exchange

Products

Release

R2021a

Asked:

on 26 Jan 2022

Commented:

on 31 Jan 2022

Community Treasure Hunt

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

Start Hunting!