https://blog.csdn.net/wxr308/article/details/104944488
以上是使用C++语言完成的QAM调制解调,这个是为了验证QAM解调是否正确采用的练习Matlab程序
仅是验证是否能够成功解调,所以没有设置可以输入的数据。
fre = 2000;
fre_Flo = fre * pi;
sam_Fre = fre * 10;
all_Sig = fre * x * 10;
car_Num = 10;
car_Sam = 10;
code_Num = car_Num * car_Sam;
code_Len=20;
len=code_Len*code_Num;
time=len/sam_Fre;
po=1/sam_Fre;
x=0:po:time;
y=0:po:time;
for i=1:1:len/4
y(i)=cos(4000*pi*x(i));
end
for i=len/4+1:1:len/2
y(i)=cos(4000*pi*x(i)+pi/2);
end
for i=len/2+1:1:len/4*3
y(i)=cos(4000*pi*x(i)+pi);
end
for i=len/4*3+1:1:len
y(i)=cos(4000*pi*x(i)+pi*1.5);
end
y1=x;
y2=x;
for i=1:1:len
y1(i)=cos(4000*pi*x(i));
end
for i=1:1:len
y2(i)=cos(4000*pi*x(i)+pi/2);
end
yo1=x;
yo2=x;
d = designfilt('lowpassfir', ... % Response type
'FilterOrder',50, ... % Filter order
'PassbandFrequency',200, ... % Frequency constraints
'StopbandFrequency',350, ...
'DesignMethod','ls', ... % Design method
'PassbandWeight',1, ... % Design method options
'StopbandWeight',2, ...
'SampleRate',20000); % Sample rate
for i=1:1:len
yo1(i)=y1(i)*y(i);
end
for i=1:1:len
yo2(i)=y2(i)*y(i);
end
figure(1)
subplot(2,1,1)
plot(x,yo1);
subplot(2,1,2)
plot(x,yo2);
yoo1=filter(d,yo1);
yoo2=filter(d,yo2);
figure(2)
subplot(2,1,1)
plot(x,yoo1);
subplot(2,1,2)
plot(x,yoo2);