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