フィルターのクリア

How can I add sinusoidal signal and fft?

1 回表示 (過去 30 日間)
studentmatlaber
studentmatlaber 2021 年 10 月 21 日
コメント済み: Chunru 2021 年 10 月 21 日
I have to add 4 sinusoidal signal and plot the spectrum. How can ı do it I dont know. After adding the signals İ will use fft. Please help me ı can not find sources. I will generate sinusoidal signals.

採用された回答

Chunru
Chunru 2021 年 10 月 21 日
fs = 1000;
f = [40 80 100 250]; % freq
a = [1 2 3 1]; % amp
p = randn(1,4)*2*pi; % phase
t = (0:1/fs:1.023)';
x = a.*cos(2*pi*f.*t + p);
figure; plot(t, x);
L=1024;
xtotal = sum(x, 2);
y = fft(xtotal, L);
P2 = abs(y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
figure
faxis = fs*(0:(L/2))/L;
plot(faxis, 20*log10(P1))
  2 件のコメント
studentmatlaber
studentmatlaber 2021 年 10 月 21 日
Thank you so much. Can i ask a question? Do these 4 signals have different spikes of the spectrum because they have different amplitude and frequency values?
Chunru
Chunru 2021 年 10 月 21 日
You are right.

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

その他の回答 (0 件)

カテゴリ

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