Conversion of equation to matlab
Show older comments
Hi, Im having some issues converting this equation to code, dont know if im missing some 'code grammer' or anything of the type.
Any help much appreciated as im still relitively new to coding. :)

Code:
WP_ROC = 1./((ROC/np)+(sqrt((2./(0.0028*sqrt((3*Cdo./K)*WSrange)*(1.155./(LDratio*np)))))));
Answers (1)
Original expression:
WP_ROC = 1./((ROC/np)+(sqrt((2./(0.0028*sqrt((3*Cdo./K)*WSrange)*(1.155./(LDratio*np)))))));
% ^^^^^^^^^^^^^^^^^^ inside inner sqrt()
% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ denominator under 2
% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ inside outer sqrt()
Looks like it should be:
WP_ROC = 1./((ROC/np)+(sqrt(2./(0.0028*sqrt(3*Cdo./K))*WSrange)*(1.155./(LDratio*np))));
% ^^^^^^^^ inside inner sqrt()
% ^^^^^^^^^^^^^^^^^^^^^^^ denominator under 2
% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ inside outer sqrt()
Or, equivalently, but removing extraneous parentheses:
WP_ROC = 1./(ROC/np+sqrt(2./(0.0028*sqrt(3*Cdo./K))*WSrange)*1.155./(LDratio*np));
Categories
Find more on Aerospace Applications in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!