作业帮 > 综合 > 作业

matlab 迭代法求矩阵

来源:学生作业帮 编辑:搜狗做题网作业帮 分类:综合作业 时间:2024/07/13 15:47:25
matlab 迭代法求矩阵
f=298.257222101;
a=6378137;
b=a-a/f;
e=1-(b/a)^2;
x=[1 2 3 4 5 6]';
y=[2 3 4 5 6 1]';
z=[3 4 5 6 1 2]';
L=atan(y./x);
B=atan(a*z./b./sqrt(x.^2+y.^2));
for i=1:200
N=a./sqrt(1-e*sin(B).^2);
B=B-(B-atan((z+N.*(e^2).*sin(B).)/sqrt(x.^2+y.^2)))/(1-N.*(e^2).*cos(B).*(x.^2+y.^2)/(x.^2+y.^2+(z+N.*sin(B).*(e^2).)));
end
用迭代法求图片所示的值,为什么老是报错呢?
matlab 迭代法求矩阵
B=B-(B-atan((z+N*(e^2).*sin(B))./sqrt(x.^2+y.^2)))./(1-N*(e^2).*cos(B).*(x.^2+y.^2)./(x.^2+y.^2+(z+N.*sin(B)*(e^2))));
% 这句有问题,有一些不必要的点(已修改)
再问: [filename, pathname]= uigetfile('*.*'); file=fullfile(pathname, filename); fidout=fopen('data3.txt','wt'); % 创建输出文件 A=importdata(file); %调用file文件数据 data=A.data; x=data(:,1); y=data(:,2); z=data(:,3); [L,B,h] = cart_changeto_geo(x,y,z); 用这个函数调用的时候还是会报错:h=sqrt(x.^2+y.^2)/cos(B)-N; 这句错了,另外怎样判断是否要加点呢?
再答: h=sqrt(x.^2+y.^2)./cos(B)-N; % 矩阵元素之间的运算要加点,矩阵之间的运算不加
再问: 那如果上题把: for i=1:200 换成 while()>eps,,eps=10^(-5) ,括号里面填什么呢?呵呵
再答: 不好意思,水平有限,不懂你的意思
再问: 不好意思啦,我是个初学者,不会表达。我想把for语句换成while语句。给B一个初始值,然后循环里面计算得到一个B,另B=B0,当B-B0