Im trying to code the following equation (Attached) in MATLAB, could someone please tell me if i coded it right. Thanks

1 次查看(过去 30 天)
eqn=Ma.*sqrt(gam.*R.*Ta).*((1+f).*sqrt(T04./Ta).*(1+((gam-1)./2).*Ma.^2).^(-0.5))-1

回答(1 个)

OCDER
OCDER 2018-10-15
eqn= Ma.*sqrt(gam.*R.*Ta).*((1+f).*sqrt(T04./Ta).*(1+((gam-1)./2).*Ma.^2).^(-0.5))-1
^ WRONG PLACE
Note: You do not need the dot-multiplier (.*) when multiply a scalar value to a matrix. Use the elementy-wise, dot-multiplier when multiplying two matrices together, element-by-element.
EX:
A = 1;
B = 2;
C = A * B; %OK
A = 1;
B = [1 2 3];
C = A * B; %OK
A = [1 2 3];
B = [1 2 3];
C = A .* B; %OK to use .* multiplier if you want C = [1 4 9].
  4 个评论
OCDER
OCDER 2018-10-15
Believe in yourself Faraz! YOU need to be able to decide what's right or wrong yourself. The different levels of confidence...
"should it be after -1?" (lacking confidence because of fear of failing)
"it should be after -1 because the brackets surround -1" (justified confidence, failed and learned many times)
"it should be after -1 because I'm always right" (over confidence, failed a lot but never learned)
"it should be after -1 because others said so. " (false confidence, majority can be incorrect too)
But, are you even sure the bracket should be after -1? Just testing :)

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by