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 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Star Strider
el 17 de Nov. de 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.
Respuestas (0)
Ver también
Categorías
Más información sobre Loops and Conditional Statements en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!