源代碼:
%2ASK的調制和解調
clear ;
m=[1 1 1000101101];
Lm= length (m);
F =200;
f =800;
A=1;
Q=fF;
if Q> =3
M=500;
t= (0:M-1)M/f;
carry1 =repmat(Asin(2 pi ft),1,Q);
Lcarry1 = length (carry1);
carry2 = kron (ones (size (m)),carry1);
載波信號
ask =kron (m,carry1);
調制后的信號
N= length (ask);
tau= (0:N-1)/(M-1)/f;
時間
Tmin =min(tau);
最小時刻
Tmax = max (tau);
最大時刻
T = ones (size (carry1));
一個數字信號’1’
dsig =kron (m,T);
數字信號波形
figure
subplot(3,1,1);
plot (tau,dsig);
title(‘數字信號)
axis([Tmin Tmax -0.21.21)
各設定坐標范圍
subplot(3,1,2);
plot (tau,carry2);
子圖分割
title (載波波形’)
畫出載波波形
axis ([Tmin Tmax -1.2 A1.2A])
設定坐標范圍
subplot(3,1,3);
plot (tau,ask);
各子圖分割
tite(經過2ASK調制后的波形”合的
畫出調制后的波形
grid on
gxe/iin Tmx -1.2A1.2.A))
L5 sig_ _mul=ask. carry2;
figure
subplot(4.1,1 );plot (tau,sig. jmul);
子圖分割
title('信號相乘后的波形’)
畫出信號相乘后的波形
axis([Tmin Tmax -0.2 1.21)
(ord,omega_c]=buttord(4pif0.6.4piE0.8,2,30.‘e0;
[num,den]= butter (Ord,omega c,‘s’);
h=tf (num,den);
獲得濾波器傳遞函式濾波
x=Isim(h,sig Jmul,tau);
運用模擬濾波器對信號進行濾波
subplot(4,1,2);
子圖分割
plot (tau,x);
畫出濾波后的濾形
title (濾波后的波形’)
axis(ITmin Tmax -0.3 0.81);
設定坐標范圍
th=0,25;
抽樣判決的網值設定
t judge= (0:Lm -1)* Lcarryl +Lcarry12;
抽樣判決點的選取
y= (x(化_judge)’;
各抽樣判決時刻時的信號值
y_ judge=1* (Yy> =th)+0* (y< =th);
抽樣判決信號值的0階保持
y_value = kron y. _judge ,ones (size (r1));1)抽樣判決后的數字信號波形
n_tau=tau+0.5/E;
抽樣判決后的信號對應的時間
subplot(4,1,3);
子圖分割
plotin tau,y. value);
畫出抽樣判決后的數字信號波形
title(抽樣判決后的數字信號波形’)
axis(min(n tau)max(n. _tau) -0.21.2]1
設定坐標范圍
subp1ot(4,1,4);
子圖分割
plotitau,dsig);
原信號波形與解調后的信號作對比
title’原始信號波形與2ASK解調后的信號作對比’)號設定坐標范圍
axis([TminTmax -0.21.21)
end
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/282400.html
標籤:其他
