谁帮我指出matlab编程代码中的错误,帮我调整下.急求!function level3[ed,dd,sd,gd,pn,h0,k1,k2,h1,s]=readlevelnetdata;global pathname net_name s_datafile a1_datafile;global ed dd sd pn gd h0 k1 k2 h1 s dh;[dh,h,V,L,uw0,uwh,uw1]=calculat
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/16 02:28:19
谁帮我指出matlab编程代码中的错误,帮我调整下.急求!function level3[ed,dd,sd,gd,pn,h0,k1,k2,h1,s]=readlevelnetdata;global pathname net_name s_datafile a1_datafile;global ed dd sd pn gd h0 k1 k2 h1 s dh;[dh,h,V,L,uw0,uwh,uw1]=calculat
谁帮我指出matlab编程代码中的错误,帮我调整下.急求!
function level3
[ed,dd,sd,gd,pn,h0,k1,k2,h1,s]=readlevelnetdata;
global pathname net_name s_datafile a1_datafile;
global ed dd sd pn gd h0 k1 k2 h1 s dh;
[dh,h,V,L,uw0,uwh,uw1]=calculatelevelnet(ed,dd,sd,pn,gd,h0,k1,k2,h1,s);
writelevelnetdata(pn,k1,k2,h1,V,L,h0,dh,h,uwh,uw0); %输出水准网计算结果
return
function[dh,h,V,L,uw0,uwh,uw1]=calculatelevelnet(ed,dd,sd,pn,h0,be,en,hd,distance);
% 水准平差网
A=sparse(zeros(sd,gd)); %求解系数阵
b=(0:(gd-1)*sd);
A(be'+b)=-1;
A(en'+b)=1;
A=A';
A=A(:,1:dd);
l=zeros(gd,1); %求解常数项
l=h0(be)-h0(en)+hd;
p=diag(1./distance); %权阵
dh=inv(A'*p*A)*A'*p*1; %高程改正数
h00=h0(dd+1:sd);
h0=h0(1:dd); %待定点高程近似值
h=h0+dh; %待定点高程平差值
V=A*dh-1; %高差观测值改正数
L=hd+V; %高差观测值平差值
%精度评定
uw0=sqrt(V'*p*V/(gd-dd)); %单位权中误差
Qxx=inv(A'*p*A);
uwh=uw0*sqrt(diag(Qxx)); %待定点高程平差值中误差
uwh(dd+1:ed+dd)=0.0;
Qff=A*Qxx*A';
uw1=uw0*sqrt(diag(Qff)); %高差平差值中误差
h=[h;h00]; %所有点高程
h0=[h0;h00];
dh=[dh;zeros(ed,1)];
return
function [ed,dd,sd,gd,pn,h0,k1,k2,h1,s]=readlevelnetdata;
global pathname net_name s_datafile b_datafile;
global ed dd sd pn gd h0 k1 k2 h1 s k11 k12;
k1=[];k2=[];h=[];s=[];
if(isempty(pathname)|isempty(net_name))
[filename,pathname]=uigetfile('*.txt','Input filename');
i=find('.'==filename);
net_name=filename(1:i-1);
end
fid1=fopen(strcat(pathname,net_name,s_datafile),'rt');
if(fid1==-1)
msgbox('Input File or Path is not correct','Warning','warn');
return;
end %open afile to read
%open afile to read
ed=fscanf(fid1,'%f',1); %已知点个数
dd=fscanf(fid1,'%f',1); %未知点个数
sd=ed+dd; %总点数
gd=fscanf(fid1,'%f',1); %观测点个数
pn=fscanf(fid1,'%f',sd); %点号
%known data
h0=fscanf(fid1,'%f',ed); %已知点高程
h0(dd+1:ed+dd)=h0(1:ed)
heightdiff=fscanf(fid1,'%f',[4,gd]);
heightdiff=heightdiff';
k1=heightdiff(:,1); %起点
k2=heightdiff(:,2); %终点
k11=heightdiff(:,1); %起点
k12=heightdiff(:,2); %终点
h1=heightdiff(:,3); %高差
s=heightdiff(:,4); %距离
fclose('all');
%点号转换
[k1,k01]=chkdat(sd,pn,k1);
[k2,k02]=chkdat(sd,pn,k2);
h0(1:dd)=20000.;
ie=0;
while(1)%计算近似高程
for k=1:gd
i=k1(k);
j=k2(k);
if(h0(i)le4)
h0(j)=h0(i)+h1(k);
ie=ie+1;
end
if(h0(i)>le4&h0(j)
谁帮我指出matlab编程代码中的错误,帮我调整下.急求!function level3[ed,dd,sd,gd,pn,h0,k1,k2,h1,s]=readlevelnetdata;global pathname net_name s_datafile a1_datafile;global ed dd sd pn gd h0 k1 k2 h1 s dh;[dh,h,V,L,uw0,uwh,uw1]=calculat
错误报告呢.