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 次查看(过去 30 天)
显示 更早的评论
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 个评论
Star Strider
2018-11-17
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.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!