Вы находитесь на странице: 1из 4

Compte Rendu:

ELECTRONIQUE NUMERIQUE

Réalise par : EL AZZOUZI AYOUB


Programmes sur MATLAB

I. La conversion A/N N/A :


U=10; % range signal from 0 to 10
n=3 % number of bits
q=U/(2^n-1) % quantizationinterval
t=0:0.1:10; % your time vector
y=abs(10*sin(t)); % your signal
% -------convert to a digital signal yd-----------
a=fix(y/q);
yd=dec2bin(a,n)
% ------youcancalculate the signal yq ----------
yq=a*q
%-------------------------------------------------
plot(t,y,'r')
hold on
plot(t,yq,'g')
hold off
II. La modulation et la demodulation :
closeall;
clearall;
fs = 2000; % Samplingfrequency
f = 5; % Signal frequency
fc = 250; % Carrier frequency
N = 2000; % Use 1 sec of data
t = (1:N)/fs; % Time axis for
plotting
wn = .02; % PSD lowpassfiltercut
- off frequency
[b,a] = butter(2,wn); % Design lowpassfilter
% Generate AM signal
w = (1:N)* 2*pi*fc/fs; % Carrier frequency =
250 Hz
w1 = (1:N)*2*pi*f/fs; % Signal frequency = 5
Hz
vc = sin(w); % Define carrier
vsig = sawtooth(w1,.5); % Define signal
vm = (1 + .5 * vsig) .* vc; % Createmodulated
signal with a Modulation constant = 0.5
subplot(3,1,1);
plot(t,vm,'k'); % Plot AM
Signal....axis, label,title.......
% Add noise with 3.16 times power (10 db) of signal for SNR of
-10 db
noise = randn(1,N);
scale = (var(vsig)/var(noise)) * 3.16;
vm = vm + noise * scale; % Add noise to
modulated signal
subplot(3,1,2);
plot(t,vm,'k'); % Plot AM
signal..axis, label,title.......
% Phase sensitive detection
ishift = fix(.125 * fs/fc); % Shift carrier by 1/4
vc = [vc(ishift:N) vc(1:ishift-1)]; % period (45 deg)
usingperiodic shift
v1 = vc .* vm; % Multiplier
vout = filter(b,a,v1); % Applylowpassfilter
subplot(3,1,3);
plot(t,vout,'k');% Plot AM Signal

III. La modulation BPSK :


clearall;
closeall;
%Data brutes UL
X = floor((rand(1,1000)+0.5));

%Codage & Modulation BPSK


alpha = zeros(1,length(X));
for k=1:length(X)
if X(k) == 0
alpha(k) = 1;
elseif X(k) == 1
alpha(k) = -1;
end
end
phi = (pi/2).*alpha;
%Signal temporel modulé
fe=125*10^6;
t = linspace(0,12,length(phi))/fe;

s = exp(i.*(2*pi*fe.*t + phi));
plot(t,s)

Вам также может понравиться