通信原理课程设计副本Word下载.docx

上传人:b****6 文档编号:20692062 上传时间:2023-01-25 格式:DOCX 页数:24 大小:153.65KB
下载 相关 举报
通信原理课程设计副本Word下载.docx_第1页
第1页 / 共24页
通信原理课程设计副本Word下载.docx_第2页
第2页 / 共24页
通信原理课程设计副本Word下载.docx_第3页
第3页 / 共24页
通信原理课程设计副本Word下载.docx_第4页
第4页 / 共24页
通信原理课程设计副本Word下载.docx_第5页
第5页 / 共24页
点击查看更多>>
下载资源
资源描述

通信原理课程设计副本Word下载.docx

《通信原理课程设计副本Word下载.docx》由会员分享,可在线阅读,更多相关《通信原理课程设计副本Word下载.docx(24页珍藏版)》请在冰豆网上搜索。

通信原理课程设计副本Word下载.docx

%x轴写t,y轴写s2(t),

figure

(2)%画第二个图形

plot(f1,abs(s1f));

%在第二个图形中画s1的频谱图

function[f,sf]=T2F(t,st)

%ThisisafunctionusingtheFFTfunctiontocalculateasignal'

sFourier

%Translatation

%Inputisthetimeandthesignalvectors,thelengthoftimemustgreater

%than2

%Outputisthefrequencyandthesignalspectrum

dt=t

(2)-t

(1);

%时域微分

df=1/T;

%频域微分

N=length(st);

%st的长度

%f=-N/2*df:

df:

N/2*df-df;

f=-N/2*df:

%频率的计算

sf=fft(st);

%对st进行fft运算

sf=T/N*fftshift(sf);

%将fft的DC分量移到频谱中心

%dff=df/8;

%ff=-50*df:

dff:

50*df;

%mf=sinc(ff*T);

%sf=cov(mf,sf);

%NN=length(f)+length(ff)-1;

%f=-NN/2*dff:

NN/2*dff-dff;

图形分析:

由频谱可知频谱关于x=0对称,且在x=0取得最小值,在x=-+17左右取得最大值

所计算的值:

E1=0.0554P2=0.5010E1_f=12.5250P2_f=5010

1.2周期方波的傅立叶级数展开

T=1;

N_sample=128;

%采样点的个数

dt=T/N_sample;

%采样间隔

T-dt;

y=[ones(1,N_sample/2)-ones(1,N_sample/2)];

%函数的分布,由左半边的1和右半边%的-1构成方波

ft=y;

ft=reshape(ft,1,N_sample);

%串并变换

subplot(211);

%将图形分为两部分,并画第一部分图形

plot(t,ft);

%画函数的图形

axis([01-22]);

%y轴显示范围为0——1,x轴显示范围为-2——2

f=-df*(N_sample/2):

df*(N_sample)/2-df;

%频率的范围和分度值

subplot(212);

stem(f,abs(fftshift(fft(ft))));

%进行fft计算

方波的傅立叶级数在f=0出取得最大值,再由两边递减。

第四章:

信道

4.1信道失真示意

Ts=1;

N_sample=8;

%每个码元的抽样点数

dt=Ts/N_sample;

%抽样间隔

N=1000;

%码元数

(N*N_sample-1)*dt;

gt1=ones(1,N_sample);

%NRZ非归零波形

gt2=ones(1,N_sample/2);

%RZ归零波形

gt2=[gt2zeros(1,N_sample/2)];

mt3=sinc((t-5)/Ts);

%sinc(pi*t/Ts)波形,截断取10

%个码元

gt3=mt3(1:

10*N_sample);

d=(sign(randn(1,N))+1)/2;

%产生序列

data=sigexpand(d,N_sample);

%对序列间隔插入N_sample-1个0

st1=conv(data,gt1);

%data和gt1进行线性

st2=conv(data,gt2);

%data和gt2进行线性

d=2*d-1;

%变成双极性序列

st3=conv(data,gt3);

%data和gt3进行线性

xt=st1;

%无失真信道

[f,xf]=T2F(t,xt);

%对xt进行fft运算

hf1=exp(-j*pi*f);

yf1=xf.*hf1;

[t1,yt1]=F2T(f,yf1);

%幅频失真信道

hf2=sinc(f).*exp(-j*pi*f);

yf2=xf.*hf2;

[t2,yt2]=F2T(f,yf2);

%相频失真、群时延无失真信道

f1=find(f<

0);

hf3=exp(-j*pi*f+j*pi);

yf3=xf.*hf3;

[t3,yt3]=F2T(f,yf3);

%相频、群时延失真信道

figure

(1)

subplot(221)

plotyy(f,abs(hf1),f,angle(hf1));

幅频、相频特性'

title('

线性无失真信道'

gridon

subplot(222)

plot(t1,real(yt1))

经过信道后的输出信号'

axis([0,20,-1.21.2])

subplot(223)

plotyy(f,abs(hf2),f,angle(hf2)/pi)

·

幅频失真信道'

f'

subplot(224)

plot(t2,real(yt2))

figure

(2)

subplot(211)

plotyy(f,abs(hf3),f,angle(hf3)/pi)

相频失真、群时延无失真信道'

subplot(212)

plot(t3,real(yt3))

gridon;

%subplot(223)

%plotyy(f,abs(hf4),f,angle(hf4)/pi;

ylabel(‘幅频、相频特性’);

%title(‘相频失真、群时延失真信道'

);

gridon;

xlabel(‘f’);

%subplot(224)

%plot(t4,real(yt4));

%axis([0,20,-1.21.2]);

xlabel(‘t’)

函数中调用的sigexpand函数

function[out]=sigexpand(d,M)

N=length(d)

out=zeros(M,N)

out(1,:

)=d

out=reshape(out,1,M*N)

函数中调用的T2F函数

dt=t

(2)-t

(1)

T=t(end)

df=1/T

N=length(st)

N/2*df-df

sf=fft(st)

sf=T/N*fftshift(sf)

函数中调用的F2T函数

function[tst]=F2T(f,sf)

df=f

(2)-f

(1)

Fmx=(f(end)-f

(1)+df)

dt=1/Fmx

N=length(sf)

T=dt*N

T-dt

sff=ifftshift(sf)

st=Fmx*ifft(sff)

Figure1

Figure2

第五章

Ô

Ê

¾

Ä

£

â

µ

÷

Ö

Æ

²

¨

Ð

Î

¼

°

½

AM

Å

´

dt=0.001;

±

ä

É

Ñ

ù

¸

ô

fm=1;

×

î

ß

Â

fc=10;

Ø

T=5;

º

³

¤

T;

mt=sqrt

(2)*cos(2*pi*fm*t);

%N0=0.01;

ë

¥

¹

¦

Õ

Ã

Ü

È

%AMmodulation

A=2;

s_am=(A+mt).*cos(2*pi*fc*t);

B=2*fm;

ø

Í

Ë

¿

í

%noise=noise_nb(fc,B,N0,t)£

»

ú

%s_am=s_am+noise;

subplot(311)

plot(t,s_am);

holdon;

ö

AMÐ

plot(t,A+mt,'

r--'

ê

AMµ

ü

ç

'

%AMdemodulation

rt=s_am.*cos(2*pi*fc*t);

à

rt=rt-mean(rt);

[f,rf]=T2F(t,rt);

[t,rt]=lpf(f,rf,2*fm);

subplot(312)

plot(t,rt);

plot(t,mt/2,'

Ï

ó

Ó

subplot(313)

[f,sf]=T2F(t,s_am);

psf=(abs(sf).^2)/T;

plot(f,psf);

axis([-2*fc2*fc0max(psf)]);

function[tst]=lpf(f,sf,B)

%Thisfunctionfilteraninputdatausingalowpassfilteratfrequency

%domain

%Inputs:

%f:

frequencysamples

%sf:

inputdataspectrumsamples

%B:

lowpass'

sbandwidthwitharectanglelowpass

%Outputs:

%t:

%st:

outputdata'

stimesamples

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);

function[out]=noise_nb(fc,B,N0,t)

%outputthenarrowbandgaussiannoisesamplewithsingle-sided

%powerspectrumN0

%atcarrierfrequencyequalsfcandbandwidthequalsB

Fmx=1/dt;

n_len=length(t);

p=N0*Fmx;

rn=sqrt(p)*randn(1,n_len);

[f,rf]=T2F(t,rn);

[t,out}=bpf(f,rf,fc-B/2,fc+B/2);

Fmx=(f(end)-f

(1)+df);

dt=1/Fmx;

N=length(sf);

T=dt*N;

sff=ifftshift(sf);

st=Fmx*ifft(sff);

5.2

%FMmodulationanddemodulation

Kf=5;

%信源

%mt=cos(2*pi*fm*t)+1.5*sin(2*pi*0.3*fm*t);

%信源信号

mt=cos(2*pi*fm*t);

%FM调制

A=sqrt

(2);

%mti=1/2/pi/fm*sin(2*pi*fm*t)-3/4/pi/0.3/fm*cos(2*pi*0.3*fm*t);

%mt的积分函数

mti=1/2/pi/fm*sin(2*pi*fm*t);

st=A*cos(2*pi*fc*t+2*pi*Kf*mti);

subplot(311);

plot(t,st);

plot(t,mt,'

%xlabel('

调频信号'

FMmodulatedsingnal'

[fsf]=T2F(t,st);

plot(f,abs(sf));

axis([-252503])

调频信号幅度谱'

SpectrumoftheFMsignal'

%FM解调

fork=1:

length(st)-1

rt(k)=(st(k+1)-st(k))/dt;

end

rt(length(st))=0;

plot(t,A*2*pi*Kf*mt+A*2*pi*fc,'

调频信号微分后包络'

signalenvelopeafterdifferentiator'

第六章、

%6.1Ê

ý

ª

é

ã

T=N*N_sample*dt;

%NRZ·

Ç

Á

%NRZ¹

%sin(pi*t/Ts)/pi*t/Ts²

¬

¡

10¸

ò

å

N_sample-1¸

«

[f,st1f]=T2F(t,[st1(1:

length(t))]);

[f,st2f]=T2F(t,[st2(1:

[f,st3f]=T2F(t,[st3(1:

subplot(321)

plot(t,[st1(1:

grid

axis;

([020-1.51.5]);

NRZ²

subplot(322)

plot(f,10*log10(abs(st1f).^2/T));

axis([-55-4010]);

NRZ¹

dB/Hz£

©

subplot(323)

plot(t,[st2(1:

RZ²

subplot(324)

plot(f,10*log10(abs(st2f).^2/T));

RZ¹

subplot(325)

plot(t-5,[st3(1:

([020-22]);

sinc²

t/Ts'

subplot(326)

plot(f,10*log10(abs(st3f).^2/T));

f*Ts'

补充定义函数

(1)

N=length(d);

out=zeros(M,N);

)=d;

(2)

%6.2示意双极性NRZ基带信号经过带宽受限信号造成的码间干扰影响及其眼图,文件

%每码元抽样点数

gt=ones(1,N_sample);

%输入数字序列

d=sign(randn(1,N));

a=sigexpand(d,N_sample);

st=conv(a,gt);

%数字基带信号

ht1=5*sinc(5*(t-5)/Ts);

rt1=conv(st,ht1);

ht2=sinc((t-5)/Ts);

rt2=conv(st,ht2);

eyediagram(rt1+j*rt2,40,5);

%调用Matlab画眼图的函数,行40点,表示5只眼

补充函数

out=reshape(out,1,M*N);

第七章

A=1;

fc=2;

%2HZ

N=500;

%码元数

%1baud/s

dt=Ts/fc/N_sample;

%波形采集间隔

N*Ts-dt;

T=dt*length(t);

Lt=length(t);

%产生二进制信源

dd=sigexpand((d+1)/2,fc*N_sample);

gt=ones(1,fc*N_sample);

%NRZ波形

subplot(221);

%输入NRZ信号波形(单极性)

d_NRZ=conv(dd,gt);

plot(t,d_NRZ(1:

length(t)));

axis([01001.2]);

subplot(222);

%输入NRZ频谱

[f,d_NRZf]=T2F(t,d_NRZ(1:

plot(f,10*log10(abs(d_NRZf).^2/T));

axis([-22-5010]);

DB/HZ£

%2ASK

ht=A*cos(2*pi*fc*t);

s_2ask=d_NRZ(1:

Lt).*ht;

subplot(223);

plot(t,s_2ask);

axis([010-1.21.2]);

ylabel('

2ASK'

[f,s_2askf]=T2F(t,s_2ask);

subplot(224);

plot(f,10*log10(abs(s_2askf).^2/T));

axis([-fc-4fc+4-5010]);

2ASK¹

%2PSK信号

d_2psk=2*d_NRZ-1;

s_2psk=d_2psk(1:

plot(t,s_2psk);

2PSK'

[f,s_2pskf]=T2F(t,

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 职业教育 > 中职中专

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1