이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
I want to get FFT from my .mat data that have been saved in workspace. I have a timeseries data.>> t.mat (time) & data.mat (magnitude). I want to have a continuous plot for FFT .what must I do? can anyone help me? Thank you very much.
조회 수: 6 (최근 30일)
이전 댓글 표시
get fft from discrete data>> time and magnitude that have been saved as .mat file in workspace. How can I do that???
채택된 답변
Rick Rosson
2014년 7월 27일
doc load
doc fft
doc fftshift
doc abs
doc plot
댓글 수: 14
vahid torabi
2014년 7월 27일
편집: vahid torabi
2014년 7월 27일
Thank you for answering,could you please expand your answer in more details sir?
Image Analyst
2014년 7월 27일
편집: Image Analyst
2014년 7월 27일
Rick knows what an FT is - he doesn't need an image like that to explain it. He was wondering if you attempted anything like
mySpectrum = fft(mysignal);
plot(real(mySpectrum), 'b-');
or anything like that. (Sounds like you have not attempted anything yet.) Have you tried to adapt the demo/example code in the help for fft() to your signal yet???
vahid torabi
2014년 7월 27일
I didn't want to make Rick sad,I just wanted to clarify what I'm gonna do.Sorry anyway. I've tried very codes to reach that FFT plot but I didn't. So now I'm very eager to know what is yours.Thank you very much.
Image Analyst
2014년 7월 27일
I gave you code, as did the help documentation. Did you see his comment "What have you tried so far?" We can't see it unless you copy it from your MATLAB script and paste it here, or else attach your m-file with the paper clip icon. Also supply data in addition to the code so we have something to run it on.
Rick Rosson
2014년 7월 27일
Image Analyst is right. Please post your MATLAB code here so we can see what you have tried and then we can possibly help you.
vahid torabi
2014년 7월 27일
편집: vahid torabi
2014년 7월 27일
these are my files. I've attached them. my code:
n = length(magnitude);
Ts = t(2)-t(1); % sample time
Fs = 1/Ts; % sampling frequency
NFFT = 2^nextpow2(n); % Next power of 2 from length of magnitude
Y = fft(magnitude,NFFT)/n;
f = Fs/2*linspace(0,1,NFFT/2+1);
% Plot single-sided amplitude spectrum.
plot(f,2*abs(Y(1:NFFT/2+1)))
title('Single-Sided Amplitude Spectrum of y(t)')
xlabel('Frequency (Hz)')
ylabel('|Y(f)|')
Rick Rosson
2014년 7월 27일
Your code looks pretty good. Do you have any specific questions? Does your code work as expected? Are you getting any errors?
vahid torabi
2014년 7월 28일
I don't get any error.but the plot is not the thing I wanted to be! have you tried plotting with my files that I attached for you?
Rick Rosson
2014년 7월 28일
편집: Rick Rosson
2014년 7월 28일
Please add the following line of code at the very end of the script:
xlim([0 200e3]);
Also, try replacing the plot statement with:
plot(f,20*log10(abs(Y(1:NFFT/2+1))));
Label the y axis as:
ylabel('|Y(f)| (dB)')
Finally, in the line that computes the fft, instead of dividing by n, please divide by NFFT.
Does that help?
vahid torabi
2014년 7월 28일
It worked.My special thanks goes to you sir.I really appreciate your help.I admire you for your tips.Wish you luck.
vahid torabi
2014년 8월 7일
Hi back Mr.Rick. I attached a zip file that has the results. my plot starts at -80 but in article it starts at almost 0.why??? could you please help me sir??? thank you very much.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Parametric Spectral Estimation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)