
syms t w
f1=sin(t);Fw1=fourier(f1)
f2=sin(t)/t;Fw2=fourier(f2)
f3=sym('Heaviside(t+1)-Heaviside(t-1)';
Fw3=fourier(f3)
f4=sym('Heaviside(t)');Fw4=fourier(f4)
f5=sym(1);Fw5=fourier(f5)
f6=exp(-2*abs(t));Fw6=fourier(f6)
运行得:
Fw1 =i*pi*(-dirac(w-1)+dirac(w+1))
Fw2=pi*(-heaviside(w-1)+heaviside(w+1))
Fw3 =2/w*sin(w)
Fw4 =pi*dirac(w)-i/w
Fw5 =2*pi*dirac(w)
Fw6 =4/(4+w^2)
2.验证傅里叶对称性:
2.程序如下:
syms w t
ft=sin(t)/t
subplot(4,1,3),ezplot(ft);
xlabel('t'); ylabel('Sa(t)');
Fw=fourier(ft)
subplot(4,1,2),ezplot(Fw,[-3,3])
xlabel('w'); ylabel('F(w)');
gt=sym('Heaviside(t+1)-Heaviside(t-1)');
f1t=pi*gt
subplot(4,1,1),ezplot(f1t,[-3,3])
xlabel('t'); ylabel('f(t)')
fw=fourier(f1t)
subplot(4,1,4),ezplot(fw)
xlabel('w'); ylabel('G(w)')
运行结果为:
ft =sin(t)/t Fw =pi*(-heaviside(w-1)+heaviside(w+1)) f1t =pi*(heaviside(t+1)-heaviside(t-1)) fw =2*pi/w*sin(w) 及其对应的波形如右:
3
R=0.05;t=-2:R:2;
f=-1 xlabel('t');ylabel('f(t)'); axis([-2 2 -1 1.5]); y=R*conv(f,f); n=-4:R:4;subplot(322); plot(n,y);xlabel('t'); ylabel('y(t)=f(t)*f(t)'); axis([-3 3 -1 3]); W1=2*pi*5; N=200;k=-N:N; W=k*W1/N; F=f*exp(-j*t'*W)*R; F=real(F); Y=y*exp(-j*n'*W)*R; Y=real(Y);F1=F.*F; subplot(323);plot(W,F); xlabel('w');ylabel('F(jw)'); subplot(324); plot(W,F1);xlabel('w'); ylabel('F(jw).F(jw)'); axis([-20 20 0 4]); subplot(325);plot(W,Y); xlabel('w');ylabel('Y(jw)'); axis([-20 20 0 4]); 运行结果如上: 4.1 syms t w f1=sym('Heaviside(t+0.5)-Heaviside(t-0.5)') subplot(2,1,1),ezplot(f1,[-1,1]) xlabel('t'); ylabel('f1(t)') title('(1)门函数脉冲序列信号') Fw1=fourier(f1); subplot(2,1,2),ezplot(Fw1,[-28,28]) xlabel('w'); ylabel('f1(w)') 运行结果为: f1 =Heaviside(t+0.5)-Heaviside(t-0.5) 4.2 syms t w f2=exp(-t)*sym('Heaviside(t)') subplot(3,1,1),ezplot(f2); title('(2) 单边指数信号') Fw2=fourier(f2) im=imag(Fw2) re=real(Fw2) phase=atan(im/re); subplot(3,1,2),ezplot(abs(Fw2)) subplot(3,1,3),ezplot(phase) 所求信号及其频谱图一次如右: 4.3 syms t w f3=exp(-t^2) subplot(2,1,1),ezplot(f3) ; xlabel('t'); ylabel('f3(t)') title('(3) 高斯信号') Fw3=fourier(f3) subplot(2,1,2),ezplot(Fw3) xlabel('w'); ylabel('F3(w)') 运行结果为: f3 =exp(-t^2) Fw3 =pi^(1/2)*exp(-1/4*w^2) 4.4 syms t w f4=((Heaviside(t+1)-Heaviside(t))*(t+1) +(Heaviside(t)-Heaviside(t-1))*(1-t)) subplot(3,1,1),ezplot(f4) ; xlabel('t'); ylabel('f4(t)') title('(4) 三角脉冲信号') Fw4=fourier(f4) subplot(3,1,2),ezplot(Fw4) xlabel('w'); ylabel('F4(w)') 运行结果为: f4 =(heaviside(t+1)-heaviside(t))*(t+1)+(heaviside(t)-heaviside(t-1))*(1-t) Fw4 =4/w^2*sin(1/2*w)^2 5 F=2/(1+w^2) f=ifourier(F) 运行得: F =2/(1+w^2) f =exp(x)*heaviside(-x)+exp(-x)*heaviside(x) 6. Fs=1000; Fc=400; N=1000; n=0:N-2; t=n/Fs; x=sin(2*pi*50*t); subplot(221) plot(t,x); xlabel('t(s)'); ylabel('x'); title('被调信号'); axis([0 0.1 -1 1]) Nfft=1024; window=hamming(512); noverlap=256; dflag='none'; [Pxx,f]=psd(x,Nfft,Fs,window,noverlap,dflag); subplot(222) plot(f,Pxx) xlabel('频率(Hz)'); ylabel('功率谱(X)'); title('被调信号的功率谱') grid y=modulate(x,Fc,Fs,'am'); subplot(223) plot(t,y) xlabel('t(s)'); ylabel('y'); axis([0 0.1 -1 1]) title('已调信号') [Pxx,f]=psd(y,1024,Fs,window,noverlap,dflag); subplot(224); plot(f,Pxx) xlabel('频率(Hz)'); ylabel('功率谱(Y)'); title('已调信号的功率谱'); grid 7、 syms t w ft=sym('Heaviside(t+2)-Heaviside(t-2)') f1t=ft*cos(10*pi*t) subplot(4,1,1),ezplot(ft,[-5,5]) xlabel('t'); ylabel('f(t)') subplot(4,1,2),ezplot(f1t) xlabel('t'); ylabel('f1(t)') Fw=fourier(ft);Fw1=fourier(f1t) Fp=abs(Fw);Fp1=abs(Fw1) subplot(4,1,3),ezplot(Fp) xlabel('w'); ylabel('f(w)') subplot(4,1,4),ezplot(Fp1) xlabel('w'); ylabel('F1(w)') 运行结果为: ft =Heaviside(t+2)-Heaviside(t-2) f1t=(heaviside(t+2)-heaviside(t-2))*cos(10*pi*t) Fw1 =2*w/(w-10*pi)/(w+10*pi)*sin(2*w) Fp1 =2*abs(w/(w-10*pi)/(w+10*pi)*sin(2*w))
