MATLAB周期信号的频谱分析PPT课件下载推荐.ppt
《MATLAB周期信号的频谱分析PPT课件下载推荐.ppt》由会员分享,可在线阅读,更多相关《MATLAB周期信号的频谱分析PPT课件下载推荐.ppt(69页珍藏版)》请在冰点文库上搜索。
fork=1:
2:
Kx=x+sin(k*t)/k;
y(k+1)/2,:
)=x;
endy=y*4/pi;
figure
(1);
grid;
line(0,pi+0.5,1,1);
text(pi+0.5,1,1);
figure
(2);
halft=ceil(length(t)/2);
mesh(t(1:
halft),1:
(K+1)/2,y(:
1:
halft);
max_y=max(y(K+1)/2,:
);
gibbs=(max_y-1)/2,结果显示,line和text函数,LINE(X,Y)addsthelineinvectorsXandYtothecurrentaxes.IfXandYarematricesthesamesize,onelinepercolumnisadded.TEXT(X,Y,string)addsthetextinthequotestolocation(X,Y)onthecurrentaxes,where(X,Y)isinunitsfromthecurrentplot.IfXandYarevectors,TEXTwritesthetextatalllocationsgiven.,line(1,2,3,4,5,7)text(2.1,4.8,here),mesh,gibbs=0.0892,waterfall,waterfall(t(1:
例7-2,求周期锯齿波的三角函数形式的傅里叶级数展开式。
周期锯齿波的傅里叶级数展开式为,直流,基波,谐波,编程综合锯齿波信号,t=0:
5;
T=2;
A=1;
w1=2*pi/T;
f=zeros(1,length(t);
w1为基波角频率,增加谐波信号,forn=1:
Nf=f+A*power(-1,n+1)/n/pi*sin(n*w1*t);
end,生成锯齿波信号,t1=0:
0.99;
y1=0.5*t1;
y2=y1-0.5;
y=y1y2y1y2y1;
ty=(0:
length(y)-1)*0.01;
SAWTOOTHSawtoothandtrianglewavegeneration.SAWTOOTH(T)generatesasawtoothwavewithperiod2*pifortheelementsoftimevectorT.SAWTOOTH(T)islikeSIN(T),onlyitcreatesasawtoothwavewithpeaksof+1to-1insteadofasinewave.SAWTOOTH(T,WIDTH)generatesamodifiedtrianglewavewhereWIDTH,ascalarparameterbetween0and1,t=-10:
10;
x=sawtooth(t);
plot(t,x);
y=sawtooth(t-1)*pi)(seealso),y=sawtooth(t,0.2),Seealsosquare,sin,cos,chirp,diric,gauspuls,pulstran,rectpuls,sincandtripuls.,7.3指数函数形式的傅里叶级数,1复指数正交函数集,2级数形式,3系数,利用复变函数的正交特性,指数函数乘除法方便,7.4幅频特性和相频特性,相频特性,幅频特性,帕塞瓦尔定理,这是帕斯瓦尔定理在傅里叶级数情况下的具体体现;
表明:
周期信号平均功率=直流、基波及各次谐波分量有效值的平方和;
也就是说,时域和频域的能量是守恒的。
7.5用有限项傅里叶级数表示周期信号,误差函数,方均误差,例题7.3,1三角函数形式的谱系数,2指数形式的谱系数,程序实现,%exe3_7_a.mn=-10:
Fn=sinc(n/2);
Fn(11)=0;
subplot(2,1,1);
h=stem(n,Fn);
set(h,linewidth,2);
xlabel(n);
ylabel(Fn);
subplot(2,1,2);
h=stem(n,power(abs(Fn),2);
ylabel(|Fn|2);
SINCSin(pi*x)/(pi*x)function.,7.6周期信号的功率,(b),解:
(c),n=-9:
9;
Fn(10)=0;
P=sum(power(abs(Fn),2),解:
(d),n=-99:
99;
Fn(100)=0;
P_n=2*power(abs(Fn(100:
199),2);
P_n
(1)=0;
P_evaluation=cumsum(P_n);
例题单位冲激序列的频谱,分析:
狄氏条件是傅里叶级数存在的充分条件。
根据冲激信号的定义和特性,其积分有确定值,傅里叶级数存在。
即,满足离散性,谐波性,不满足收敛性,频带无限宽。
余弦形式的频谱图,MATLAB实现,%impulse_cos.m%thisprogramisusedtoillustrateimpuseseriescanbeexpandedbycosT=1;
t=-1.2*T:
1.2*T;
f=ones(1,length(t)/T;
clf;
plot(t,f,r);
holdoncolor=r,g,b,c,y;
forn=1:
5fn=cos(n*w1*t)/T*2;
f=f+fn;
plot(t,fn,color(mod(n,5)+1);
endh=plot(t,f,k);
结果显示(N=5),结果显示(N=21),总结,pausemeshwaterfallcumsumsumclfGUIDE回调函数编写:
get,set,axesnum2strstrcatmod,7.7用傅里叶级数综合连续时间信号,例题,%exe3_11_a.mclearallsymstTX1X_1X3X_3x1=X_1*exp(-i*2*pi/T*t)+X1*exp(i*2*pi/T*t)+X_3*exp(-3*i*2*pi/T*t)+X3*exp(3*i*2*pi/T*t);
T=1;
X1=5;
X_1=5;
X3=2;
X_3=2;
x2=subs(x1);
x3=simple(x2);
ezplot(x3,0,2*T);
更新参数,T=2;
X3=1;
X_3=1;
x3=subs(x1);
figure;
符号函数,x1=X_1*exp(-2*i*pi/T*t)+X1*exp(2*i*pi/T*t)+X_3*exp(-6*i*pi/T*t)+X3*exp(6*i*pi/T*t)x2=5*exp(-2*i*pi*t)+5*exp(2*i*pi*t)+2*exp(-6*i*pi*t)+2*exp(6*i*pi*t)x3=5*exp(-i*pi*t)+5*exp(i*pi*t)+exp(-3*i*pi*t)+exp(3*i*pi*t),编程实现,%exe3_11_b.mclear;
symstTX1X2X3X4X_1X_2X_3X_4x2_1=X_1*exp(-i*2*pi/T*t)+X1*exp(i*2*pi/T*t);
x2_2=X_2*exp(-2*i*2*pi/T*t)+X2*exp(2*i*2*pi/T*t);
x2_3=X_3*exp(-3*i*2*pi/T*t)+X3*exp(3*i*2*pi/T*t);
x2_4=X_4*exp(-4*i*2*pi/T*t)+X4*exp(4*i*2*pi/T*t);
x2=x2_1+x2_2+x2_3+x2_4;
X1=i;
X_1=-i;
X2=-i/2;
X_2=i/2;
X3=i/4;
X_3=-i/4;
X4=-i/8;
X_4=i/8;
x2=subs(x2);
ezplot(x2,0,2*T);
x2=1/4*sin(4*pi*t)+sin(2*pi*t)-1/2*sin(3*pi*t)-2*sin(pi*t),例题方波的傅里叶表示,方波,这个练习将分析该方波的傅里叶级数表示,且主要集中在方波中的不连续点附近。
目的,用符号运算的方法生成傅里叶级数的系数(一个积分);
用有限项综合原信号:
(a),解:
int函数,INTIntegrate.INT(S)istheindefiniteintegral(不定积分)ofSwithrespecttoitssymbolicvariableasdefinedbyFINDSYM.SisaSYM(matrixorscalar).IfSisaconstant,theintegraliswithrespecttox.INT(S,v)istheindefiniteintegralofSwithrespecttov(对v积分).visascalarSYM.INT(S,a,b)isthedefiniteintegral(定积分)ofSwithrespecttoitssymbolicvariablefroma(下限)tob(上限).aandbareeachdoubleorsymbolicscalars.INT(S,v,a,b)isthedefiniteintegralofSwithrespecttovfromatob.,编程实现,%exe3_12_a.mclearall;
symstxTn;
x=1;
integrand=x*exp(-i*n*2*pi/T*t)/T;
Xn=int(integrand,t,-T/4,T/4);
n=-10:
Xn_N=subs(Xn);
Xn_N(length(n)+1)/2)=0.5;
h=stem(n,Xn_N);
被积函数,(b),分析:
上例已得到Xn语句,利用subs给出各系数:
产生并画出合成后的信号波形,xN=0;
forn=-10:
10xN=xN+Xn_N(n+11)*exp(i*n*2*pi/T*t);
endT=2;
subs(xN);
ezplot(xN,-T,T);
思考题,例题半波整流信号的频谱,%exercise_halfwave_cos.mx=cos(2*pi/T*t);
%被积函数Xn=int(integrand,t,-T/4,T/4);
%积分,结果显示,分析,例题奇谐函数的频谱图,代码,%exe_zheng_3_7_c.mclearall;
closeall;
clc;
integrand1=(-2*(t+1)/T)*exp(-i*n*2*pi/T*t);
integrand2=(2*t/T)*exp(-i*n*2*pi/T*t);
Xn=int(integrand1,t,-T/2,0)/T+int(integrand2,t,0,T/2)/T;
Xn_N=subs(Xn,T,5);
Xn_N=subs(Xn_N,n,-10:
-1)0subs(Xn_N,n,1:
10);
h=stem(n,abs(Xn_N);
频谱图,奇谐函数含有基波(n=1)及奇次(n=3,5,7)谐波分量,step=0.01;
x=0:
step:
10*pi;
y=sinc(x/pi);
h=plot(x,y);
set(h,LineWidth,2);
Si_wave=cumsum(y)*step;
h=plot(x,Si_wave);
set(h,LineWidth,2),正弦函数的泰勒级数展开,x=0:
y=x;
K=100forii=2:
1:
Ky_add=power(-1,ii+1)*power(x,ii*2-1)/prod(1:
(ii*2-1);
y=y+y_add;
plot(x,y,k,x,sin(x),y:
end,画Si函数波形,symsxysi_func=int(sin(x)/x,0,y);