[X, FS, NBITS]=wavread('Spring');
N= length(X);
sound (X, FS) ;
W=2\N*[0:N-1]; Digital angular frequency of continuous spectrum
FY=fft(X, N);
figure
subplot(211); plot(X); title('Original music signal waveform')
subplot(212); plot(W, abs(FY)); title('Original music signal spectrum')
Subsampling
D=12; j=0;
for i=1: D: length(X /20),
j=j 1;
X1(j)=X(i);
end
sound( X1, FS/12);
N1=1024;
W1=2\N1*[0:N1-1];
F1Y=fft( X1, N1);
figure
subplot(211); plot(X1); title('Signal waveform after subsampling')
subplot(212 ); plot(W1, abs(F1Y)); title('Signal spectrum after subsampling')
AM modulation
n=0: N-1;
x=cos(n*pi*0.8); modulated signal
Nt=length(x);
FtY=fft(x, Nt);
Wt=2/Nt*[0:Nt-1];
y=X.*x'; Modulate the signal
N2=length(y);
F2Y=fft(y, N2);
W2=2/N2*[0: N2-1];
sound(y, FS) ;
figure
plot(Wt, abs(FtY));
grid on
title ('Spectrum of modulated signal cos Figure');
figure
subplot(2, 1, 1); plot(W, abs(FY));
grid on
title ('Spectrum of the original music signal')
subplot(2, 1, 2); plot(W2, abs(F2Y));
grid on
title ('Modulated Signal Spectrum')
I am studying this recently, hope it helps