FM Frequency division multiplexing
11 views (last 30 days)
Show older comments
Hi I'm working on a project where I need to read 4 sensors at the same time and record the data hrough the audio jack (single channel). I've tried doing FDM but I'm having some issues with the results. for simplicity,i'm currently assuming that the sensors are 2 audio files and I'm doing the multiplexing and the demultiplexing at the same script (it will be separate stations in the future). I seem to be able to only recover channel 1 and it even appears with the demultiplexed channel 2. I also have some HUGE peaks and I want to know why is that? fianlly, since they are 2 signals, how can I display the sum in frequency domain to check if they were multiplexed correctly? what sampling frequecnies should I use here is my code
if true
clear all;
BW = 4000;
G=500;
[x , fs]= audioread('chan1_1k_10s.wav');
Fc= BW*2; % carrier = 1MHz
FS=2.2*Fc; % sampling frequency for output signal
deviation=20; % freq. deviation
SAfm = dsp.SpectrumAnalyzer('SampleRate',FS, ...
'Title','FM Broadcast Signal');
smod=fmmod(x, Fc, FS, deviation);
% s1=abs(fft(smod));
% plot(smod);
step(SAfm,smod);
[x2 , fs]= audioread('chan2_1k_10s.wav');
Fc2= BW*4; % carrier = 1MHz
FS2=2.2*Fc2; % sampling frequency for output signal
% deviation=2; % freq. deviation
SAfm2 = dsp.SpectrumAnalyzer('SampleRate',FS2, ...
'Title','FM Broadcast Signal');
smod2=fmmod(x2, Fc2, FS2, deviation);
step(SAfm2,smod2);
sumx = smod + smod2 ;
%% recovery wn1 = [Fc-200 Fc+200]; [A1,B1] = butter(3, wn1/FS/2, 'bandpass'); rec1 = filter(A1, B1, sumx);
%%%%%%%%%%%%%%%%%%%%%%% wn2 = [Fc2-200 Fc2+200]; [A2,B2] = butter(3,wn2/FS2/2, 'bandpass'); rec2 = filter(A2, B2, sumx);
%% demodulation demd1 = fmdemod(rec1,Fc,FS,deviation); [A11,B11] = butter(2, 30/fs/2 , 'low'); dem1 = filter(A11, B11, demd1);
%%%%%%%%%%%%%%%%%%%%%%%%%%% demd2 = fmdemod(rec2,Fc2,FS2,deviation); [A22,B22] = butter(2, 25/fs/2 , 'low'); dem2 = filter(A22, B22, demd2);
%% plotting %channel 1 t = linspace(1/fs,length(x)/fs ,length(x)); figure; subplot(211); plot(t,x);title('Channel 1 before multiplexing'); subplot(212); plot(t, dem1);title('Channel 1 after demultiplexing'); figure; plot(t,x,'c',t,dem1,'b--'); xlabel('Time (s)') ylabel('Amplitude') legend('Original Signal','Demodulated Signal')
%channel 2 figure; subplot(211); plot(t,x2);title('Channel 2 before multiplexing'); subplot(212); plot(t, dem2);title('Channel 2 after demultiplexing'); figure; plot(t,x2,'c',t,dem2,'b--'); xlabel('Time (s)') ylabel('Amplitude') legend('Original Signal2','Demodulated Signal2')
end
It's also attached, I don't know how to display it all. Recovered 1 shows the oiginal 1s file and the recovered ne. recovered2 shows the original ch2 and what looks like thre recovered ch1 again. thank you very much
0 Comments
Answers (0)
See Also
Categories
Find more on Measurements and Spatial Audio in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!