信号系统实验报告 - 百度文库 ر

stem(k1,xr)

axis([0,40,-2,2]) xlabel('k');

title('ؽX[k]'); 4-1-2 £

k1=-4:0.001:4;N=length(k);k1=(0:N)*0.5*T; x=0.5*sawtooth(w0*k1,0.5)+0.5; X=fft(x);

subplot(3,1,1) stem(k1,real(X)) xlabel('k');

title('X[k]ʵ'); axis([0,40,-20,60]) subplot(3,1,2) stem(k1,imag(X)); xlabel('k');

title('X[k]鲿'); axis([0,40,-20,60]) xr=ifft(X); subplot(3,1,3) stem(k1,xr)

axis([0,40,-2,2]) xlabel('k');

title('ؽX[k]'); нͼʾ

M4-4 MATLABźŵƵXjwƵͼ 4-4-1£

(1)x(t)?u(t)?u(t?2);(2)x(t)?cos(2t)[u(t)?u(t?2)];function yt=u(t)

yt=0*(t<0)+1*(t>=0); function yt=xx1(t,w);

yt=(u(t)-u(t-2)).*exp(-j*w*t); w=linspace(-6*pi,6*pi,512); N=length(w);X=zeros(1,N); for k=1:N

X(k)=quadl('xx1',0,2,[],[],w(k)); end

plot(w,real(X)); xlabel('\\omega'); ylabel('X(j\\omega)'); нͼʾ

4-4-2£ function yt=u(t) yt=0*(t<0)+1*(t>=0); function yt=xx2(t,w);

yt=cos(2*t).*(u(t)-u(t-2)).*exp(-j*w*t); w=linspace(-6*pi,6*pi,512); N=length(w);X=zeros(1,N); for k=1:N

X(k)=quadl('xx2',0,2,[],[],w(k)); end

plot(w,real(X)); xlabel('\\omega'); ylabel('X(j\\omega)'); нͼʾ M4-2 1

|C0|?2?|Cn|2n?12NPM4-1ͼʾźŵЧ

??0.90źŵЧȷ

Nw0ȡA=1,T=2;

(2)ЧгϳɵĽƲΣԽۺͱȽϣ (3)г۲ϳɵĽƲΣԽۺͱȽϣ

³

function y=x1(t,w);

y=cos(2*t).*(t>=0&t<=2).*exp(-j*w*t); w=linspace(-6*pi,6*pi,1024); N=length(w); X=zeros(1,N); for k=1:N

X(k)=quadl('x1',0,2,[],[],w(k)); end

figure(1)

plot(w,real(X)); xlabel('\\omega'); ylabel('X(j\\omega)' нͼʾ

M4-3 M4-3ͼʾھźŵķƵףƵͼֱȡ

T?2?,T?4?T?8?,TƵ׵Ĺϵ

³

function y=x2(t,w); y=1*exp(-j*w*t);

w=linspace(-6*pi,6*pi,512); N=length(w); X=zeros(1,N); for k=1:N

X(k)=quadl('x2',-0.001,9999,[],[],w(k)); end

plot(w,real(X)); xlabel('\\omega'); ylabel('X(j\\omega)'); нͼʾ

4-5: ֪Dzx(t)=1-t, t<1,Լ0fmHzΧźŵȡfm=0.110HZ £

function yt=x4_5_1(t);

yt=2*sinc(t).*sinc(t).*sinc(t).*sinc(t); fm=linspace(0.1,10,256); N=length(fm);E=zeros(1,N); for k=1:N

E(k)=quadl('x4_5_1',0,fm(k)); end

plot(fm,E); xlabel('Hz'); ylabel('E');