Filter löschen
Filter löschen

I am trying to output an array of results for Faxy, Fbxy, Fcxy and Fdxy, but the methods I have used so far are returning the incorrect values as I think it is carrying values. I have stripped it back down to the original to avoid confusion.

2 Ansichten (letzte 30 Tage)
H=2;
T=4;
omega=2*pi()/T;
Fd=3;
Fi=60;
for i=1:5
d=(i*5)+5;
wLo=(9.81*T^2)/(2*pi());
if wLo>(2*d)
wL=wLo*sqrt(tanh(2*pi()*d/wLo));
else
wL=wLo;
end
At=T*30*(sqrt(2)/2)/wL;
Bt=0;
Ct=T*30*(sqrt(2)/2)/wL;
Dt=2*T*30*(sqrt(2)/2)/wL;
Aphi=2*pi()*At/T;
Bphi=0;
Cphi=2*pi()*Ct/T;
Dphi=2*pi()*Dt/T;
Fa=(3*Fd/4)*((sin((omega.*At)+Aphi)-(sin(3*((omega*At)+Aphi))/3)))+(Fi*cos((omega*At)+Aphi));
Fb=(3*Fd/4)*((sin((omega.*Bt)+Bphi)-(sin(3*((omega*Bt)+Bphi))/3)))+(Fi*cos((omega*Bt)+Bphi));
Fc=(3*Fd/4)*((sin((omega.*Ct)+Cphi)-(sin(3*((omega*Ct)+Cphi))/3)))+(Fi*cos((omega*Ct)+Cphi));
Fd=(3*Fd/4)*((sin((omega.*Dt)+Dphi)-(sin(3*((omega*Dt)+Dphi))/3)))+(Fi*cos((omega*Dt)+Dphi));
Faxy=(sqrt(2)/2)*Fa
Fbxy=(sqrt(2)/2)*Fb
Fcxy=(sqrt(2)/2)*Fc
Fdxy=(sqrt(2)/2)*Fd
end
  3 Kommentare
Scott Sanders
Scott Sanders am 17 Nov. 2018
The code is supposed to determine wave forces acting on the legs of a 4-legged jack up rig.
The correct values are
d Faxy Fbxy Fcxy Fdxy
10.00 -12.61 42.43 -12.61 -36.80
15.00 -15.33 42.43 -15.33 -33.33
20.00 -15.33 42.43 -15.33 -33.33
25.00 -15.33 42.43 -15.33 -33.33
30.00 -15.33 42.43 -15.33 -33.33
35.00 -15.33 42.43 -15.33 -33.33
40.00 -15.33 42.43 -15.33 -33.33
45.00 -15.33 42.43 -15.33 -33.33
50.00 -15.33 42.43 -15.33 -33.33
The remain constant after 15 because of the if statement
Star Strider
Star Strider am 17 Nov. 2018
Your code runs without error, so you likely made a logic error somewhere. It would probably be worthwhile posting the equations you are coding, to see if we can find the problem.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by