Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clear all;
- clc;
- clf;
- fm = 1000; % freq of message signal
- Am = 2; % amplitude
- fc = 10000; % freq of carrier signal
- Ac = 1;
- Fs = 32*fc; % sampling freq
- N = 3*Fs/fm; % samples
- n = 0:N-1;
- signal = Am*sin( 2*pi*fm/Fs*n );
- subplot(311); plot(n, signal); % message signal
- %% Modulation
- kf = 150*pi; % modulator freq sens [ Hz / V ]
- %beta = kf*Am/fm;
- %mod_fm = Ac*cos(2*pi*fc/Fs*n+beta*sin(2*pi*fm/Fs*n));
- mod_int = kf*1.e-4*cumsum(signal);
- mod_fm = cos(2*pi*fc/Fs*n + mod_int);
- subplot(312); plot(n, mod_fm);
- %% Demodulation
- demod_fm = diff(mod_fm);
- demod_fm = [ 0, demod_fm ];
- demod_fm = abs(demod_fm);
- %% Filter
- f_3dB = 1500;
- rzad = 3;
- [B, A] = butter(rzad, f_3dB/Fs*2);
- demod_filter = filter(B, A, demod_fm);
- subplot(313); plot(n, demod_filter);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement