I get an error in the loop

2 次查看(过去 30 天)
K=[27 27320.5963 4223312.4563
32 25496.3840 4221760.5030
34 28874.9170 4221756.7649
39 27284.2609 4220235.3943
133 26812.2676 4221811.7328]
olc=[0.00000
70.76351
105.09584
0.00000
42.40162
89.83755
0.00000
50.28006
98.61182
0
36.51504
106.45528
0
80.90273
160.68555
276.73136]
dn=[27;27;27;32;32;32;34;34;34;39;39;39;133;133;133;133]
bn=[34;133;32;27;133;39;39;133;27;32;133;34;27;34;39;32]
dog_olc=[dn bn olc]
R=6373394
for i = 1:length(dog_olc)
dn=dog_olc(i,1); bn=dog_olc(i,2); olc=dog_olc(i,3);
xi=K(find(K(:,1)==dn,2)); yi=K(find(K(:,1)==dn,3));
xk=K(find(K(:,1)==bn,2)); yk=K(find(K(:,1)==bn,3));
dt=((-200/pi)/(6*R^2))*((xk-xi)*(2*yi+yk));
Dog_olc(i)=dog_olc(3,i)+dt
end
There are results visually. I do not succeed in getting these results.

采纳的回答

KSSV
KSSV 2017-3-30
clc; clear all ;
K=[27 27320.5963 4223312.4563
32 25496.3840 4221760.5030
34 28874.9170 4221756.7649
39 27284.2609 4220235.3943
133 26812.2676 4221811.7328] ;
olc=[0.00000
70.76351
105.09584
0.00000
42.40162
89.83755
0.00000
50.28006
98.61182
0
36.51504
106.45528
0
80.90273
160.68555
276.73136] ;
dn=[27;27;27;32;32;32;34;34;34;39;39;39;133;133;133;133] ;
bn=[34;133;32;27;133;39;39;133;27;32;133;34;27;34;39;32] ;
dog_olc=[dn bn olc] ;
N = size(dog_olc,1) ;
R=6373394 ;
Dog_olc = zeros(N,1) ;
for i = 1:N
dn=dog_olc(i,1); bn=dog_olc(i,2); olc=dog_olc(i,3);
xi=K(find(K(:,1)==dn,2)); yi=K(find(K(:,1)==dn,3));
xk=K(find(K(:,1)==bn,2)); yk=K(find(K(:,1)==bn,3));
dt=((-200/pi)/(6*R^2))*((xk-xi)*(2*yi+yk));
Dog_olc(i)=dog_olc(i,3)+dt ;
end
Dog_olc
  4 个评论
Muhendisleksi
Muhendisleksi 2017-3-30
编辑:Muhendisleksi 2017-3-30
dt(1,1)= ((-200/pi*10000)/(6*R^2))*((4221756.7650-4223312.4563)*(2*27320.5963+28874.917))
Dog_olc(1,1)=0.339375914157676
This should be the process.
Muhendisleksi
Muhendisleksi 2017-3-30
I saw my mistake! thank you very, very much.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by