How to demodulate a sound through MATLAB
23 ビュー (過去 30 日間)
古いコメントを表示
DSB-SC Demodulation in MATLAB
Hi.
I have to record a sound which was already modulated in a certain carrier frequency (from 4000Hz to 16000Hz), and demodulate the recorded sound with MATLAB so that I can play the demodulated sound, which is close to the original sound. And these procedures have to run in MATLAB.
So far, I made a code which can load the sound data and plot the data in fft(fast fourier transform). Here is my code. --------------------------------------------
N=length(data);
F1=0:fs/N:fs-fs/N;
FFT_data=fft(data);
figure;
plot(F1(1:N),abs(FFT_data(1:N)));
xlabel('Frequency')
ylabel('Amplitude')
axis([0 2000 0 1000])
grid on
--------------------------------------------
But I can't really develope it into the DSB-SC demodulation code.
Can anyone help me with this?
And this is the demodulation code which I've found in a website.
I hope this code to be helpful.
--------------------------------------------
% task 1
fc=154000;
% task 2
fm=fc/10;
fs=100*fc;
t=0:1/fs:4/fm;
xc=cos(2*pi*fc*t);
xm=cos(2*pi*fm*t);
figure(1)
subplot(2,1,1),plot(t,xc);
title('carrier signal of 154 khz');
xlabel('time (sec)');
ylabel('amplitude');
subplot(2,1,2),plot(t,xm);
title('message signal of 15.4 khz');
xlabel('time (sec)');
ylabel('amplitude');
% DSB-SC MODULATION
z1= xm.*xc;
figure(2)
% task 3.1
subplot(2,1,1),plot(t,z1);
title('DSB-SC MODULATION IN TIME DOMAIN');
xlabel('time (sec)');
ylabel('amplitude');
% task 3.2
l1=length(z1);
f=linspace(-fs/2,fs/2,l1);
Z1=fftshift(fft(z1,l1)/l1);
subplot(2,1,2),plot(f,abs(Z1));
title('DSB SC MODULATION IN FREQUENCY DOMAIN');
xlabel('frequency(hz)');
ylabel('amplitude');
axis([-200000 200000 0 0.3]);
% task 3.3 demodulation
s1=z1.*xc;
S1=fftshift(fft(s1,length(s1))/length(s1));
figure(3)
plot(f,abs(S1));
title(' demodulated signal IN FREQUENCY DOMAIN before filtering');
xlabel('frequency(hz)');
ylabel('amplitude');
axis([-200000 200000 0 0.3]);
hold on
Hlp=1./sqrt(1+(f./fc).^(2*100));
plot(f,Hlp,'g');
title(' frequency response of low pass filter');
xlabel('frequency(hz)');
ylabel('amplitude');
axis([-200000 200000 0 2]);
% task 3.4
E1=Hlp.*S1;
figure(4)
subplot(2,1,1),plot(f,E1);
title(' Recover signal IN FREQUENCY DOMAIN after filtring');
xlabel('frequency(hz)');
ylabel('amplitude');
axis([-200000 200000 0 0.3]);
e1=ifft(ifftshift(E1))*length(E1);
subplot(2,1,2),plot(t,(1/0.5)*e1);
title(' Recover signal IN Time DOMAIN after filtring');
xlabel('time(sec)');
ylabel('amplitude');
--------------------------------------------
0 件のコメント
回答 (1 件)
Zhao Wang
2016 年 9 月 27 日
I understand that you want to build a DSBSC demodulator to demodulate a recorded sound file. You might refer to the following links from MATLAB File Exchange:
https://www.mathworks.com/matlabcentral/fileexchange/34590-amplitude-modulation-matlab-code/content/dsbsc.m https://www.mathworks.com/matlabcentral/fileexchange/33106-dsb-sc-modulation
If you have any question regarding the file exchange submissions, contact the authors of the submissions directly.
There is also a "DSBSC AM Demodulator Passband" block in the Communications System Toolbox. You can use it to check the performance of the demodulator you construct. For more details about this demodulator block, refer to the following link:
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で PHY Components についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!