一、简介
1 4ASK信号的原理

2 4ASK调制解调原理



二、源代码
M=4;
d=1;
t=0:0.001:0.999;
a=randint(1,20,2);
i=1000;
for n=0:9
sym(n+1)=a(2*n+1)*2+a(2*n+2);
end
s=sym(ceil(10*t+0.01)).*cos(2*pi*100*t);
subplot(4,1,1);
plot(t,a(ceil((100*t+0.1)/5)));
title('二进制信号');
axis([0,1,-0.2,1.2]);
subplot(4,1,2);
plot(t,sym(ceil(10*t+0.01)));
title('四进制信号');
subplot(4,1,3);
plot(t,s)
title('4ASK信号');
%相干解调
at=s.*cos(2*pi*100*t);
at=at-mean(at);
[f,af]= T2F(t,at);%通过低通滤波器
[t,at]= lpf(f,af,80);
% 抽样判决
for m=0:9;
if at(1,m*100+50)>0.5;
for j=m*100+1:(m+1)*100;
at(1,j)=3;
end
else
if at(1,m*100+50)>0;
for j=m*100+1:(m+1)*100;
at(1,j)=1;
end
%脚本文件F2T.m定义了函数F2T,计算信号的反傅立叶变换。
function [t,st]=F2T(f,sf)
%This function calculate the time signal using ifft function for the input
%signal's spectrum
df = f(2)-f(1);
Fmx = ( f(end)-f(1) +df);
dt = 1/Fmx;
N = length(sf);
T = dt*N;
%t=-T/2:dt:T/2-dt;
t = 0:dt:T-dt;
sff = fftshift(sf);
st = Fmx*ifft(sff);
function [t,st]=lpf(f,sf,B)
%This function filter an input data using a lowpass filter
%Inputs: f: frequency samples
% sf: input data spectrum samples
% B: lowpass's bandwidth with a rectangle lowpass
%Outputs: t: time samples
% st: output data's time samples
df = f(2)-f(1);
T = 1/df;
hf = zeros(1,length(f));%全零矩阵
bf = [-floor( B/df ): floor( B/df )] + floor( length(f)/2 );
hf(bf)=1;
yf=hf.*sf;
[t,st]=F2T(f,yf);
st = real(st);- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
- 41.
- 42.
- 43.
- 44.
- 45.
- 46.
- 47.
- 48.
- 49.
- 50.
- 51.
- 52.
- 53.
- 54.
- 55.
- 56.
- 57.
- 58.
- 59.
- 60.
- 61.
- 62.
- 63.
- 64.
三、运行结果


被折叠的 条评论
为什么被折叠?



