Hello; Can someone please help me matlab doesn't plot my excel data it show the axis only I am trying to make spectral analysis.i have attested the excel file and code as well.
古いコメントを表示
filename = 'datacollect2.xlsx';
N = length(filename);
fs = 400;
fnyquest = fs/2;
num = xlsread(filename);
y = num(: ,2);
mags = abs(fft(y));
bin_vals = [0 : N-1];
fax_Hz = bin_vals*fs/N;
N_2 = ceil(N/2);
plot(mags(1:N_2),fax_hz(1:N_2))
xlabel('Frequency (Hz)')
ylabel('Power (dB)');
title('Single-sided Power spectrum (Hertz)');
axis tight
5 件のコメント
Jan
2017 年 5 月 14 日
What happens instead of the expected plotting? Do you get an error message? Does the axes appear but is empty? Please explain any details.
dpb
2017 年 5 月 15 日
編集済み: Image Analyst
2017 年 5 月 15 日
For one thing you've reversed the role of X and Y in
plot(mags(1:N_2), fax_hz(1:N_2));
The file isn't attached
Image Analyst
2017 年 5 月 15 日
You might also use semilogy() instead of plot(),
semilogy(mags(1:N_2), fax_hz(1:N_2))
or take the log of the data before plotting, like
mags = log(abs(fft(y)));
arif hussain
2017 年 5 月 16 日
arif hussain
2017 年 5 月 16 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Parametric Modeling についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!