The plot for Frequency Domain Signal wont show up, where is the problem?

4 ビュー (過去 30 日間)
NUR ADRIANA HUSNA SHAHRIMAN
NUR ADRIANA HUSNA SHAHRIMAN 2024 年 6 月 20 日
回答済み: Ayush Modi 2024 年 6 月 20 日
t = readmatrix('10pc_NFhpf.csv');
%sample rate
dt = 2.5e-07
%sample FREQUENCY
fs = 1/dt;
%time domain signal
figure
plot(t(1:2002,2));
title('Time Domain Signal');
xlabel('Time (t)');
ylabel('Amplitude');
t = t(1:2002,2);
t_f = fft(t);
m = length(t_f);
freq = (-m/2:(m/2-1))*fs/(m-1);
figure
plot(freq,fftshift(abs(t_f)));
title('Frequency Domain Signal');
xlabel('Frequency (Hz)');
ylabel('Amplitude');

回答 (1 件)

Ayush Modi
Ayush Modi 2024 年 6 月 20 日
Hi,
When running the provided code, with the attached file, variable t_f is being calculated to NaN values.
% Output of disp(t_f)
NaN + 0.0000i
NaN + NaNi
NaN + NaNi
NaN + NaNi
NaN + NaNi
. . .
However, MATLAB does not plot NaN values and so the plot is not visible.
I would suggest to recheck the values in the attached file.

カテゴリ

Help Center および File ExchangeSignal Attributes and Indexing についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by