To find the frequency components in the data and make a frequency plot

4 ビュー (過去 30 日間)
aneps
aneps 2018 年 1 月 4 日
コメント済み: aneps 2018 年 1 月 5 日
I have a data which is a frequency modulated signal. I want to make a matlab code to find the frequency components in it using Fourier transform method and make a frequency plot? I tried fft(data(:,2)) but most of the time it is giving me wrong answers. I am attaching the data. The first column is time and the second column is the signal.

採用された回答

Birdman
Birdman 2018 年 1 月 4 日
Use the attached file with the following code:
filename='Test_Sample_edited.txt';
A=load(filename);
time=A(:,1);
signal=A(:,2);
h1=spectrum.welch;
set(h1,'Windowname','Hann');
Fs=1000;
set(h1,'OverlapPercent',66.7);
set(h1,'SegmentLength',2048);
myPsd=psd(h1,A(:,2)-mean(A(:,2)),'Fs',Fs)
semilogx(myPsd.Frequencies,myPsd.Data);xlabel('Frequency(rad/sec)');
  5 件のコメント
Birdman
Birdman 2018 年 1 月 5 日
It will work if you change the following line accordingly:
set(h1,'SegmentLength',2048);
For your initial data, it is 2048 but if other data is smaller than this, than you have to change the value to 1024 or 512, to a reasonable value.
aneps
aneps 2018 年 1 月 5 日
Yes... Thank you.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDiscrete Fourier and Cosine Transforms についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by