本研究通过MATLAB平台对PSK通信系统的性能进行仿真分析,为毕业论文提供了详实的数据支持和技术评估。
```matlab
clear all; close all;
fs = 8e5;% Sampling frequency
fm = 20e3;% Baseband frequency
n = 2*(6*fs/fm);
final = (1/fs)*(n-1);
fc = 2e5; % Carrier frequency
t = 0:1/fs:(final);
Fn=fs/2;% Nyquist frequency
% Use sine wave to generate square wave
twopi_fc_t = 2*pi*fm*t;
A = 1; phi = 0;
x = A * cos(twopi_fc_t + phi);
am = 1;
x(x>0) = am; x(x<0)=-1;
figure(1);
subplot(3,2,1); plot(t,x); axis([0 2e-4 -2 2]); title(Baseband signal); grid on
car=sin(2*pi*fc*t);% Carrier wave
ask=x.*car;% PSK modulation
subplot(3,2,2); plot(t,ask); axis([0 200e-6 -2 2]); title(PSK Signal); grid on;
vn=0.1;
noise = vn*(randn(size(t)));% Generate noise
subplot(3,2,3); plot(t,noise); grid on; title(Noise signal); axis([0 .2e-3 -1 1]);
askn=(ask+noise);
subplot(3,2,4); plot(t,askn); axis([0 200e-6 -2 2]); title(Signal after adding noise); grid on;
% Band-pass filter
fBW=40e3;
f=[0:3e3:4e5];
w=2*pi*f/fs;
z=exp(w*j);
BW=2*pi*fBW/fs;
a=.8547;% BW = 2(1-a)/sqrt(a)
p=(j^2*a^2);
gain=.135;
Hz=gain*(z+1).*(z-1)./(z.^2-(p));
subplot(3,2,5); plot(f,abs(Hz)); title(Band-pass filter); grid on;
Hz(Hz==0)=10^(8);% To avoid log(0)
subplot(3,2,6); plot(f,20*log10(abs(Hz))); grid on; title(Receiver -3dB Filter Response); axis([1e5 3e5 -3 1]);
b=[0.135 0 -0.135];% gain*[1 0 -1]
a=[1 0 0.7305];% [1 0 p]
faskn=filter(b,a,askn);
figure(2)
subplot(3,2,1); plot(t,faskn); axis([0 100e-6 -2 2]); title(Output after band-pass filter); grid on;
cm=faskn.*car;% Demodulation
subplot(3,2,2); plot(t,cm); axis([0 100e-6 -2 2]); grid on; title(Signal after demodulator);
% Low-pass filter
p=0.72;
gain1 = 0.14;% gain=(1-p)/2
Hz1=gain1*(z+1)./(z-(p));
subplot(3,2,3); Hz1(Hz1==0)=10^(-8);
plot(f,20*log10(abs(Hz1))); grid on; title(LPF -3dB response); axis([0 5e4 -3 1]);
b1=[0.14 0.14];% gain*[1 1]
a1=[1 -0.72];%(z-(p))
so=filter(b1,a1,cm);
so = so*10;% Add gain
so = so-mean(so);% Remove DC component
subplot(3,2,4); plot(t,so); axis([0 8e-4 -3.5 3.5]); title(Output after low-pass filter); grid on;
High=2.5;
Low=-2.5;
vt = 0;% Set comparison standard
error = 0;
len1=length(so);
for ii=1:len1
if so(ii) >= vt
Vs(ii)=High;
else
Vs(ii)=Low;
end
end
Vo=Vs;
subplot(3,2,5); plot (t,Vo), title(Output after demodulation), axis([0 2e-4 -5 5]), grid on;
xlabel(Time (s)), ylabel(Amplitude