I want to mirror my signal over the y axis and make 4 repetitions of it

6 ビュー (過去 30 日間)
Iztok Grof
Iztok Grof 2021 年 1 月 15 日
回答済み: Prudhvi Peddagoni 2021 年 1 月 18 日
Hello
I am trying to show that the frequency specter of a signal repeats itself. I wrote a code which samples a signal and plots its frequency specter, but it only shows the specter from 0 onwards (half the signal), and only 1 repetition.
I wish for it to be symetric over the y axis and repeat itself, something in this style:(pardon my symplisti drawing)
this is my code:
Fs=1e6; %%%% frequency of sampling
t=0:1/Fs:0.001;
f=10000;
x=0.5*(square(2*pi*f*t)+1);
nfft=1024;
X=fft(x,nfft);
X=X(1:nfft/2);
mx=abs(X);
f=(0:nfft/2-1)*Fs/nfft;
subplot(212)
plot(f,mx), title('Freq. Spekter, Fs = 1MHz'), xlabel('frekvenca (Hz)'), ylabel('moč')
grid on
Thanks

採用された回答

Prudhvi Peddagoni
Prudhvi Peddagoni 2021 年 1 月 18 日
Hi,
After calling the fft function, you are removing half of the values from variable X. That is the reason you are not seeing symmetry.
Hope this helps.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMeasurements and Feature Extraction についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by