系统建模与仿真作业 下载本文

z2=sin(2*pi*f0*i/(3*fs)); y1=zeros(M,N); y2=zeros(M,N); for i=1:N

y1(1:M,i)=(z1.*s(1:M,i)')'; y2(1:M,i)=(z2.*s(1:M,i)')'; end

wt1=2*pi*(4*f1)/(3*fs);%wt1=4pi/45 wt2=2*pi*(7*f1)/(3*fs);%wt2=7pi/45 th=wt2-wt1;

M1=ceil(6.6*pi/th)+1;%M1=70 wt3=(wt1+wt2)/2;%wt3=11pi/90 hd=wide(wt3,M1); w=(hamming(M1))'; h=hd.*w; L=length(h); z1=zeros(M+L-1,N); z2=zeros(M+L-1,N); I=zeros(M,N); Q=zeros(M,N); K=ceil(L/2); for i=1:N for j=1:10

z1(1+(j-1)*M/10:j*M/10+L-1,i)=conv(h,y1(1+(j-1)*M/10:j*M/10,i)')';

z2(1+(j-1)*M/10:j*M/10+L-1,i)=conv(h,y2(1+(j-1)*M/10:j*M/10,i)')';

I(1+(j-1)*M/10:j*M/10,i)=z1(1+(j-1)*M/10+K:j*M/10+K,i); Q(1+(j-1)*M/10:j*M/10,i)=z2(1+(j-1)*M/10+K:j*M/10+K,i); end end

w1=I(:)';w2=Q(:)'; subplot(4,1,1); j=0:length(w1)-1;

plot(j,w1),title('I路信号'); subplot(4,1,2);

plot(j,w2),title('Q路信号'); subplot(4,1,3); w=w1+i*w2;

plotpu(w),title('频谱'); subplot(4,1,4);

plotpu(h),title('幅频特性');

function [x,y]=AD(z1,z2)%模数转换 m1=min(min(z1)); m2=min(min(z2)); Vmax=6; N=12;

x=Vmax/(2^N)*floor((z1-m1)*2^N/Vmax); y=Vmax/(2^N)*floor((z2-m2)*2^N/Vmax); [M,N]=size(z1); for i=1:N

x(1:M,i)=Vmax/(2^N)*floor((z1(1:M,i)-m1)*2^N/Vmax);

y(1:M,i)=Vmax/(2^N)*floor((z2(1:M,i)-m2)*2^N/Vmax); end w1=x(:)'; w2=y(:)'; subplot(2,1,1); plot(w1); subplot(2,1,2); plot(w2);

function [I1,Q1]=maichongyasuo(I,Q,h)%对正交两路信号进行脉冲压缩 [M,N]=size(I); K=M/10; f0=3*10^7; fs=3*f0; Tr=600/f0;

mt2=floor(3*Tr*fs/10); mt4=floor(3*Tr*fs/5); i1=I(mt2+1:mt2+K,1:N); q1=Q(mt2+1:mt2+K,1:N); for i=1:N

S1(1:K,i)=fft(i1(1:K,i)); S2(1:K,i)=fft(q1(1:K,i)); w_ham=(hamming(K)); h1=h.*w_ham'; H1=fft(h);

s(1:K,i)=(S1(1:K,i)+j*S2(1:K,i)).*H1'; S3(1:K,i)=ifft(s(1:K,i));

end

i2=I(mt4+1:mt4+K,1:N); q2=Q(mt4+1:mt4+K,1:N); for i=1:N

P1(1:K,i)=fft(i2(1:K,i)); P2(1:K,i)=fft(q2(1:K,i)); w_ham=(hamming(K)); h1=h.*w_ham'; H1=fft(h);

p(1:K,i)=(P1(1:K,i)+j*P2(1:K,i)).*H1'; P3(1:K,i)=ifft(p(1:K,i)); end

I1=[I(1:mt2,1:N)',real(S3)',I(mt2+K+1:mt4,1:N)',real(P3)',I(mt4+K+1:M,1:N)']';

Q1=[I(1:mt2,1:N)',imag(S3)',I(mt2+K+1:mt4,1:N)',imag(P3)',I(mt4+K+1:M,1:N)']';

w1=I1(:)'; w2=Q1(:)';

w3=sqrt(w1.^2+w2.^2); i=0:N*M-1; subplot(3,1,1);

plot(i,w1),title('I路信号'); subplot(3,1,2);

plot(i,w2),title('Q路信号'); subplot(3,1,3);

plot(i,w3),title('两路合成一路');

function [s1,s2]=MTI(x1,x2)%做动目标检测 [M,N]=size(x1); s1=zeros(M,N); for i=1:M for j=1:N if(i==1)

s1(i,j)=x1(i,j); else

s1(i,j)=x1(i,j)-x1(i-1,j); end end end for i=1:M for j=1:N if(i==1)

s2(i,j)=x2(i,j); else

s2(i,j)=x2(i,j)-x2(i-1,j); end end end w1=s1(:)'; w2=s2(:)'; i=0:length(w1)-1; subplot(2,1,1);

plot(i,w1),title('MTI'); subplot(2,1,2);