Adding an extra column

조회 수: 2 (최근 30일)
bhador
bhador 2018년 1월 14일
답변: John BG 2018년 1월 15일
n = [0.037 ; 0.020 ; 0.015 ; 0.030 ; 0.022];
S = [0.0001 ; 0.0002 ; 0.0011 ; 0.0007 ; 0.0003];
B = [10 ; 8 ; 20 ; 24 ; 15];
H = [2 ; 1 ; 1.5 ; 3 ; 2.7];
Table = [n S B H];
U=(sqrt(S)/n).*((B.*H)/(B+(2.*H))).^(2/3)
I keep having zeros in the end, does anyone know what's wrong with my commands?
Thank you in advance.

답변 (2개)

Walter Roberson
Walter Roberson 2018년 1월 15일
The MATLAB operator for vector division is ./ not /
The / operator is algebraic matrix division. A/B is similar to A * pinv(B)

John BG
John BG 2018년 1월 15일
Hi
Instead of
U=(sqrt(S)/n).*((B.*H)/(B+(2.*H))).^(2/3)
use
U=(sqrt(S)./n).*((B.*H)./(B+(2.*H))).^(2/3)
now
U =
0.342820077892896
0.609366151578033
2.639575139271204
1.580890997815293
1.243620437003919
is now U as expected?

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by