Sie sind auf Seite 1von 1

clc;

clf;
t=0:50;
fm=100;
a=5;
x_t = a*sin (2*(22/7)*fm*t);
subplot (2, 2, 1);
plot (t, x_t);
title ('SINUSOIDAL SIGNAL OF 100Hz');
xlabel ('t--->');
ylabel ('Amplitude');
grid;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
n=0:1:10;
fs1=1*fm;
fs2=2*fm;
fs3=3*fm;
x1_n = a*sin (2*(22/7)*(fm/fs1)*n); %%%%%%% fs < fm
x2_n = a*sin (2*(22/7)*(fm/fs2)*n); %%%%%%% fs = fm
x3_n = a*sin (2*(22/7)*(fm/fs3)*n); %%%%%%% fs > fm
X1_n = fft (x1_n, 8); %%%fft of signal sampled with sampling rate fs<fm
X2_n = fft (x2_n, 8); %%%fft of signal sampled with sampling rate fs=fm
X3_n = fft (x3_n, 8); %%%fft of signal sampled with sampling rate fs>fm
magX1 = abs (X1_n); %%%Magnitude of fft of signal sampled with sampling
rate fs<fm
magX2 = abs (X2_n); %%%Magnitude of fft of signal sampled with sampling
rate fs=fm
magX3 = abs (X3_n); %%%Magnitude of fft of signal sampled with sampling
rate fs>fm
subplot (2, 2, 2);
k = 0:7;
plot (k, magX1); %%% Plot the magnitude of fft of signal sampled with
sampling rate fs<fm
title ('SPECTRUM OF 100Hz SINUSOIDAL SIGNAL [for fs < fm]');
xlabel ('w--->');
ylabel ('Amplitude');
grid;
subplot (2, 2, 3);
plot (k, magX2); %%% Plot the magnitude of fft of signal sampled with
sampling rate fs=fm
title ('SPECTRUM OF 100Hz SINUSOIDAL SIGNAL [for fs = fm]');
xlabel ('w--->');
ylabel ('Amplitude');
grid;
subplot (2, 2, 4);
plot (k, magX3); %%% Plot the magnitude of fft of signal sampled with
sampling rate fs>fm
title ('SPECTRUM OF 100Hz SINUSOIDAL SIGNAL [for fs > fm]');
xlabel ('w--->');
ylabel ('Amplitude');
grid;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Das könnte Ihnen auch gefallen