桂林电子科技大学课程设计(论文)报告用纸 第 31 页 共 33 页
dpsk(1,j)=1; end end end subplot(413); plot(t,dpsk); axis([0,5,-1,2]); title('抽样判决后波形')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%码反变换 dt=zeros(1,i);%%全零矩阵 dt(1)=st(1); for n=2:10;
if (st(n)-st(n-1))<=0&&(st(n)-st(n-1))>-1; dt(n)=0; else dt(n)=1; end end st=t; for n=1:10 if dt(n)<1;
for m=j/i*(n-1)+1:j/i*n st(m)=0; end else
for m=j/i*(n-1)+1:j/i*n st(m)=1; end end end subplot(414); plot(t,st); axis([0,5,-1,2]); title('码反变换后波形');
用到的傅立叶T2F函数
桂林电子科技大学课程设计(论文)报告用纸 第 32 页 共 33 页
%利用FFT计算信号的频谱并与信号的真实频谱的抽样比较。 %脚本文件T2F.m定义了函数T2F,计算信号的傅立叶变换。 function [f,sf]= T2F(t,st)
%This is a function using the FFT function to calculate a signal's Fourier %Translation
%Input is the time and the signal vectors,the length of time must greater %than 2
%Output is the frequency and the signal spectrum dt = t(2)-t(1); T=t(end); df = 1/T; N = length(st);
f=-N/2*df:df:N/2*df-df; sf = fft(st); sf = T/N*fftshift(s);
用到的低通滤波器函数 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);
用到的反傅立叶函数
%脚本文件F2T.m定义了函数F2T,计算信号的反傅立叶变换。 function [t,st]=F2T(f,sf)
%This function calculate the time signal using ifft function for the input
桂林电子科技大学课程设计(论文)报告用纸 第 33 页 共 33 页
%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);
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库基于MATLAB的二进制数字系统的调制(包括2ask,2fsk,2psk,2dpsk)(7)在线全文阅读。
相关推荐: