% Demodulation demodulated_signal = modulated_signal .* c; % Low-pass filter (to remove high-frequency components) cutoff_freq = 2 * fm; % Cut-off frequency [b, a] = butter(6
2 views (last 30 days)
Show older comments
modulation
demodulation
1 Comment
Answers (1)
William Rose
on 24 Dec 2023
Suppose the original signal is a 17 Hz sine wave plus a 23 Hz cosine wave, 0.2 seconds long, plus an offset so it is always positive:
fs=1e4; % sampling rate (Hz)
t=0:1/fs:0.2; % time (s)
y=2+sin(2*pi*17*t)+cos(2*pi*23*t); % original signal
Suppose the carrier wave frequency is 1 kHz.
fcarrier=1000; % carrier freq (Hz)
c=cos(2*pi*fcarrier*t); % carrier wave
Choose a modulation index, M, so that the modulating signal stays non-negative:
M=1/max(abs(y)); % modulation index
Use y to amplitude-modulate the carrier. Call the AM signal x.
x=y.*c*(1+M); % A.M. signal
Plot what you have so far:
figure; subplot(211); plot(t,y,'-r'); grid on; title('Original Signal')
subplot(212); plot(t,x,'-g'); grid on; title('A.M. Signal'); xlabel('Time (s)')
Your original signal and carrier frequency will be different, but the code above gets you started.
Now let's try to extract y, from x. In other words, demodulate the AM signal.
You can take it from here. Define a lowpass filter with an appropriate cutoff frequency. Rectify y (i.e. take its absolute value) and then apply the lowpass filter to it. You could use Matlab's filter() or filtfilt(). Read the help for filter() or filtfilt(). Good luck.
0 Comments
See Also
Categories
Find more on Digital Filtering in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!