I am trying to implement fft on 33 signals collected from Cadence(noise signals). I need to use it over the spatial domain. Therefore I tried to do the fft from scratch without using the fft function in Matlab because when I used that it gives the fft output in the temporal domain. I am not getting the output I am expecting when I use (f(x)*e^-jwx). The signals are in the form of 33x501 form; 501 samples from each signal.
I would like some help here.
This is the part of the code where fft is implemented.
for k = 1:33
w = 1 * (k-18)/17;%continuous range of spatial
x=1:1:501;
H(k ,:) = 1000*nnt(k,:)*(sum(exp(-j*w*x))) ; %nnt is the input noise signal matrix
end

 채택된 답변

William Rose
William Rose 2024년 1월 29일

0 개 추천

Matlab's fft() will work fine on spatial data. The only difference is in the interpretation of the transform. The Fourier transform of a function of time is a function of temporal frequency; the Fourier transform of a function of space is a function of spatial frequency.
I understand that nnt is a 33x501 array. It appears that you want to compute the Fourier transform of each row of nnt separately. Then you could do
nnt=randn(33,501); % nnt= 33 noisy signals
NNT=zeros(size(nnt)); % allocate array for Fourier transforms
for i=1:33
NNT(i,:)=fft(nnt(i,:));
end
Each row of NNT is the Fourier transform of the corresponding row of nnt.

댓글 수: 5

The loop is not actually necessary. Tell fft what dimension you want for the transform, and it will do everything else.
Try this —
H = fft(nnt,[],2)/size(nnt,2);
colv = linspace(0, 1, 501);
Fs = 1/mean(diff(colv));
Fn = Fs/2;
freqv = (1:33)*(250/33);
nnt = sin(freqv.'*colv*2*pi)*100; % Create Matrix (33 Rows Of 501-Element Signals)
NFFT = 2^nextpow2(size(nnt,2));
H = fft(nnt.*hann(size(nnt,2)).',[],2)/size(nnt,2); % Windowed Fourier Transform
Fv = linspace(0, 1, NFFT/2+1)*Fn;
Iv = 1:numel(Fv);
figure
waterfall(Fv, (1:33), abs(H(:,Iv))*2)
grid on
colormap(turbo)
colorbar
xlabel('Frequency')
ylabel('Row')
zlabel('Magnitude')
title('Row-Wise Fourier Transform Of A Matrix')
% axis('equal')
axis('tight')
view(-10, 25)
.
William Rose
William Rose 2024년 1월 29일
@Star Strider, nice! Thanks.
Star Strider
Star Strider 2024년 1월 29일
My pleasure!
Just illustrating the concept, elaborating a bit on the details.
@Star Strider Thank you I think I needed that
Star Strider
Star Strider 2024년 1월 29일
Our pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

질문:

2024년 1월 29일

댓글:

2024년 1월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by