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
댓글 수: 0
답변 (1개)
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
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 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!