?? pskdemo.m
字號:
% This is a program for demodulating MPSK containing gauss noise
%
pack;
Fl=1000;
t1=1;
d=1;
% create mpsk signal
M=8;
[x]=mpsk_gen(M,Fl,t1,d);
x1=real(x);
x2=imag(x);
figure;
plot(x1,x2,'*r');
axis('square');
hold on;
a=-1:1/100:1;
b=1-a.*a;
plot(a,sqrt(b),'--');
hold on
plot(a,-sqrt(b),'--');
grid on;
% generate gauss noise
sgma=0.1;
[gs1,gs2]=gngauss(0,sgma);
Fl=1000;
Fs=4000;
delta_fc=300;
dela=pi/9;
B=0.25;
[I1,Q1]=test_sig(Fl,Fs,x,delta_fc,dela,B);
I11=I1+gs1;
Q11=Q1+gs2;
[del_w,I,Q]=feqtq(Fl,Fs,I11,Q11);
[y1,y2]=xc_psk(Fl,Fs,I,Q,x1,x2,M);
% demonstrate
z=ones(1,floor(Fs/Fl));
X1=x1'*z;
X2=x2'*z;
[r,c]=size(X1);
X1=X1.';
X2=X2.';
X1=reshape(X1,1,r*c);
X2=reshape(X2,1,r*c);
t=0:1/Fs:(r*c-1)/Fs;
Z3=(I1+j*Q1).*exp(-j*del_w*t);
X3=real(Z3);
Y3=imag(Z3);
%h=0.5+0.5*cos(2*pi*Fl*(t-0.5/Fl));
%X1=X1.*h;
%X2=X2.*h;
figure;
subplot(2,1,1);
plot(X1(1:200));
grid on;
subplot(2,1,2);
plot(X2(1:200));
grid on;
figure;
subplot(2,1,1);
plot(I11(1:200));
grid on;
subplot(2,1,2);
plot(Q11(1:200));
grid on;
figure;
subplot(2,1,1);
plot(X3(1:200));
grid on;
subplot(2,1,2);
plot(Y3(1:200));
grid on;
z=ones(1,floor(Fs/Fl));
Y1=y1'*z;
Y2=y2'*z;
[r,c]=size(Y1);
Y1=Y1.';
Y2=Y2.';
Y1=reshape(Y1,1,r*c);
Y2=reshape(Y2,1,r*c);
figure;
subplot(2,1,1);
plot(Y1(1:200));
grid on;
subplot(2,1,2);
plot(Y2(1:200));
grid on;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -