求高手检查
求检查 我这个程序运行不出来:clc;
[Filename,Pathname]=uigetfile('','选择谱数据'); %输入能谱数据
fid=fopen([Pathname Filename],'r');
array_z=fscanf(fid,'%d',inf);
fclose(fid);
count=length(array_z);
x=linspace(0,count,count);
plot(x,array_z)
array_feng=[3603,1029,545];
array_dao=[703,1505,5198];
FWHM=zeros(1,3);
E=zeros(1,3);
for i=1:3
E(i)=array_dao(i)*0.0003396;
for j=array_dao(i)-10:array_dao(i)
if array_z(j)>array_feng(i)/2
Ib=array_z(j);
Eb=0.0003396*j;
Ia=array_z(j-1);
Ea=0.0003396*(j-1);
end
end
for k=array_dao(i):array_dao(i)+10
if array_z(k)<array_feng(i)/2
Id=array_z(k);
Ed=0.0003396*k;
Ic=array_z(k-1);
Ec=0.0003396*(k-1);
end
end
I=array_dao(i)*0.0003396;
FWHM(i)=Ed+(I-Id)/(Ic-Id)*(Ec-Ed)-(Ea+(I-Ia)/(Ib-Ia)*(Eb-Ea));
end
L1='a+b*sqrt(E(1)+c*E(1)*E(1))=FWHM(1)';
L2='a+b*sqrt(E(2)+c*E(2)*E(2))=FWHM(2)';
L3='a+b*sqrt(E(3)+c*E(3)*E(3))=FWHM(3)';
g=solve(L1,L2,L3)
但是我检查出只是这部分程序出错误了:
L1='a+b*sqrt(E(1)+c*E(1)*E(1))=FWHM(1)';
L2='a+b*sqrt(E(2)+c*E(2)*E(2))=FWHM(2)';
L3='a+b*sqrt(E(3)+c*E(3)*E(3))=FWHM(3)';
g=solve(L1,L2,L3)
而我把它换成:
L1='a+b*sqrt(0.2387+c*0.2387*0.2387)=0.0017 ';
L2='a+b*sqrt(0.5111+c*0.5111*0.5111)=0.0101';
L3='a+b*sqrt(1.7652+c*1.7652*1.7652)=0.0076';
g=solve(L1,L2,L3)
却算的出来 两者是等价的算出来检查过
[ 本帖最后由 nba123344 于 2012-9-15 09:49 编辑 ]