フィルターのクリア

Plotting frequency spectrum of signal

1 回表示 (過去 30 日間)
Jorge Cantu
Jorge Cantu 2015 年 5 月 7 日
回答済み: Star Strider 2015 年 5 月 7 日
Hi everyone, here I am just trying to plot a one-sided frequency spectrum, but my graph doesn't appear to look right corresponding to the signal. Am I doing something wrong?
My plot is posted below as well as my code:
close all;
clear all;
N = 8;
n = 0:N-1; % numbering the samples
xn=3+5*sin(2*pi*4000*n/N)+2*sin(2*pi*6000*n/N);
MFx = abs(fft(xn));
plot(n(1:N/2),MFx(1:N/2)) % plot posi
tive frequencies xlabel('Frequency (Bins)') ylabel('Magnitude'); title('Single-sided Magnitude spectrum (bins)');

回答 (1 件)

Star Strider
Star Strider 2015 年 5 月 7 日
Your code is correct. Experiment with larger values of ‘N’, perhaps N=64.

カテゴリ

Help Center および File ExchangeSpectral Measurements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by