How to find frequency contents in this signal below?

1 回表示 (過去 30 日間)
Abhishek Nayak
Abhishek Nayak 2019 年 8 月 20 日
編集済み: Adam Danz 2019 年 8 月 26 日
  2 件のコメント
Adam Danz
Adam Danz 2019 年 8 月 20 日
Abhishek Nayak
Abhishek Nayak 2019 年 8 月 20 日
編集済み: Abhishek Nayak 2019 年 8 月 20 日
Thanks for answering the question, but I was not able to get the adequate results by using fft. Can you please figure out the probem in the folowing code
The code I followed is shown below.
%% to obatin the datas in the figure
h = findobj(gca,'Type','line')
x=get(h,'Xdata') ;
y=get(h,'Ydata') ;
%% using fft to obtain the frequency contents in the signal
sam=x(end)/length(x); % sampling time
X=fft(y); % using fft
P2=abs(X/length(X)); % To normalize and obtain magnitude
P1=P2(1:1+(length(X)+1)/2); % To compute the single-sided spectrum P1
fre=(1/sam)*(0:(length(X)+1)/2); % To obtain the spread of freqency
figure(25)
plot(fre,P1) % To plot the frequency contents in the signal
It can be seen from the asked figure that the freqency contenets are in low freqency range but the obtained results are in very fast freqency range.

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

回答 (1 件)

Abhishek Nayak
Abhishek Nayak 2019 年 8 月 26 日
編集済み: Adam Danz 2019 年 8 月 26 日
I figured it out finaly,
there was a mistake in the code
%% to obatin the datas in the figure
h = findobj(gca,'Type','line')
x=get(h,'Xdata') ;
y=get(h,'Ydata') ;
%% using fft to obtain the frequency contents in the signal
sam=x(end)/length(x); % sampling time
X=fft(y); % using fft
P2=abs(X/length(X)); % To normalize and obtain magnitude
P1=P2(1:1+(length(X)+1)/2); % To compute the single-sided spectrum P1
fre=(1/sam)*(0:(length(X)+1)/2)/length(X); % To obtain the spread of freqency
figure(25)
plot(fre,P1) % To plot the frequency contents in the signal

カテゴリ

Help Center および File ExchangeFourier Analysis and Filtering についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by