amplitude and phase spectrum
조회 수: 40 (최근 30일)
이전 댓글 표시
i have this signal.
x=8*cos(30*pi*t+pi/3)+6*sin(50*pi*t-pi/3)+8*cos(70*pi*t-pi/4)
i want to make
- single-sided amplitude spectrum
- single-sided phase spectrum
- double-sided amplitude spectrum
- double-sidedphase spectrum
i want the final graphs to look like this. how do i do this ? This above image is just an example not the correct values. Im confused because all the answers suggest fft
댓글 수: 0
채택된 답변
Star Strider
2021년 4월 13일
No idea what the sampling frequency is, so I created one.
Try this:
Fs = 600;
t = linspace(0, Fs*10, Fs*10)/Fs;
x=8*cos(30*pi*t+pi/3)+6*sin(50*pi*t-pi/3)+8*cos(70*pi*t-pi/4);
L = numel(t);
Fc = fft(x)/L;
Ts = mean(diff(t));
Fn = Fs/2;
Fv2 = linspace(-Fn, Fn, numel(t));
figure
subplot(2,1,1)
plot(Fv2, fftshift(abs(Fc)))
title('Amplitude')
grid
subplot(2,1,2)
plot(Fv2, angle(fftshift(Fc)))
title('Phase')
grid
sgtitle('Double-Sided Fourier Transform')
Fv = linspace(0, 1, fix(L/2)+1)*Fn;
Iv = 1:numel(Fv);
figure
subplot(2,1,1)
plot(Fv, abs(Fc(Iv))*2)
title('Amplitude')
grid
subplot(2,1,2)
plot(Fv, angle(Fc(Iv)))
title('Phase')
grid
sgtitle('Single-Sided Fourier Transform')
.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Spectral Measurements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!