How to get the FFT of a PRC file

조회 수: 1 (최근 30일)
Annonymous User
Annonymous User 2015년 10월 28일
댓글: Annonymous User 2015년 10월 28일
I have a code to plot information by extracting a file
% %%
clear
[filename, pathname] = uigetfile('*.raw;*.prc', 'Pick raw or processed data file');
N=str2double(filename(5:6));
% load processed file
fid = fopen([pathname filename],'r','b');
A= fread(fid,inf,'*single')';
prcdata=reshape(A,N,[])';
plot((1:size(prcdata,1))./1.16E6, prcdata (:,6))
title(strrep(filename,'_','-'))
fclose(fid);
I want to plot the FFT (fast fourier transform) of the data I plotted in the above code. I tried the following code
% %%
clear
plot(fft(1:size(prcdata,1))./1.16E6, prcdata (:,6))
and also
% %%
y= (prcdata (:,6));
z= fft(y);
plot z;
But none seem to be working I want to exchange the plot I obtained with the plot for the FFT for the same

채택된 답변

Roger
Roger 2015년 10월 28일
y= prcdata(:,6); x=1:size(prcdata,1); z= fft(y); plot(x,z);
  댓글 수: 2
Annonymous User
Annonymous User 2015년 10월 28일
thank you for the code got the warning when I ran the code Warning: Imaginary parts of complex X and/or Y arguments ignored > In Myfile (line 12) It seems not to be working I need to line 12 was plot (x,z); i was looking for x and y axis to be the same values as my code so tried y=prcdata(:,6)/1.16E6; x=(1:size(prcdata,1)/1.16e6); z=fft(y) plot (x,z); so got the error saying it should be of the same values
Annonymous User
Annonymous User 2015년 10월 28일
thank you the code is working now :) cheers

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by