Info
この質問は閉じられています。 編集または回答するには再度開いてください。
Help me in using loop "For and if"
1 回表示 (過去 30 日間)
古いコメントを表示
Hi, every one.
I have a problem of simulating the operation of a ship, in which I have used loops "For and if" for solving. I wrote in matlab and obtained results but Result is not correct. I think i did mistake with these loop. Please fix me the following code. In the picture show the scheme of this model. Many thanks
clear all;
clc;
R=300;
v=11;
zt=33;
P=77;
Q=0;
Q2=0;
q=4;
hpr=2;
hw=[1.5 1.8 2.2 2.3 2 2.3 2.4 2.5 2.7 3 1.8 1.5 1.5 1.8 2.2 2.3 2.1 2.3 2.4 2.5 2.7 3 1.8 1.5 1.5 1.8 2.2 2.3 2.1 2.3 2.4 2.5 2.7 3 1.8 1.5...
1.5 1.8 2.2 2.3 2.1 2.3 2.4 2.5 2.7 3 1.8 1.5 1.5 1.8 2.2 2.3 2.1 2.3 2.4 2.5 2.7 3 1.8 1];
t=0;
tper=R*1.6/(v*1.82)*1.1/24
tst=2;
for i=1:60
if hw(i)<hpr
t2=0
Q=q+Q
z=(i+tper)*2
else
t2=tst
Q=q+Q
z=(i+tper)*2
if (z/zt<1.1) || Q>P
t=i+tper+tper+t2
if t>30
Q1=Q
break;
end
end
end
end
0 件のコメント
回答 (0 件)
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!