jiejie2009
2010-07-02, 12:34
最近在做高斯分布的振幅,半高宽NL=30,我只是验证一下我的程序能否算出我输入的高斯分布的振幅的半高宽,可是做出的程序算出来的半高宽是50,请教高手,我错在哪?
clc,clear,close all;
t=200;%时间
m=600;%时间份数
stept=t/m;
Y2=zeros(m,1);
Ip0=zeros(m,1);
NL=30;
for i=1:m%for t
t2=i*stept-t/2;
Ep0(i,1)=exp(-(t2*t2)/(NL*NL));
Y2(i,1)=i;
end%for i
plot(Y2(:,1),Ep0(:,1),'b-');
%计算
temp=max(Ep0(:,1));
Ztemp=-temp+Ep0(:,1);%Φ-Φm
center=Center(m,Ztemp);%center是编号
Ztemp1=Ep0(:,1)-(temp/2);%Φ-Φm/2
Ztemp2=abs(Ztemp1);
Ztemp3=submatrix(1,center,Ztemp2);
Ztemp4=min(Ztemp3);
Ztemp5=Ztemp3-Ztemp4;
T1=Center(center,Ztemp5);
Tleft=T1*stept;
Ztemp12=submatrix(center+1,m,Ztemp2);
Ztemp13=min(Ztemp12);
Ztemp15=Ztemp12-Ztemp13;
kkk=m-center;
T2=Center(kkk,Ztemp15);
Tright=(T2+center)*stept;
ma=Tright-Tleft
clc,clear,close all;
t=200;%时间
m=600;%时间份数
stept=t/m;
Y2=zeros(m,1);
Ip0=zeros(m,1);
NL=30;
for i=1:m%for t
t2=i*stept-t/2;
Ep0(i,1)=exp(-(t2*t2)/(NL*NL));
Y2(i,1)=i;
end%for i
plot(Y2(:,1),Ep0(:,1),'b-');
%计算
temp=max(Ep0(:,1));
Ztemp=-temp+Ep0(:,1);%Φ-Φm
center=Center(m,Ztemp);%center是编号
Ztemp1=Ep0(:,1)-(temp/2);%Φ-Φm/2
Ztemp2=abs(Ztemp1);
Ztemp3=submatrix(1,center,Ztemp2);
Ztemp4=min(Ztemp3);
Ztemp5=Ztemp3-Ztemp4;
T1=Center(center,Ztemp5);
Tleft=T1*stept;
Ztemp12=submatrix(center+1,m,Ztemp2);
Ztemp13=min(Ztemp12);
Ztemp15=Ztemp12-Ztemp13;
kkk=m-center;
T2=Center(kkk,Ztemp15);
Tright=(T2+center)*stept;
ma=Tright-Tleft