Have a problem about code

I'm new in matlab and I have a problem below
Cs=[0.15:0.15:0.45];
Cx=0.12;
C0= 0.08;
Erf=(Cs-Cx)/(Cs-C0)
Why Erf answer have only 1 answer, it should have 9 answers?

2 件のコメント

DGM
DGM 2021 年 10 月 3 日
編集済み: DGM 2021 年 10 月 3 日
Why would it have 9 elements? If you use elementwise division instead of matrix division, it'll have 3.
Cs = 0.15:0.15:0.45;
Cx = 0.12;
C0 = 0.08;
Erf = (Cs-Cx)./(Cs-C0)
Erf = 1×3
0.4286 0.8182 0.8919
If you transpose one of the vectors, you can get 9, but I don't know if that's intended.
Erf = (Cs-Cx)./(Cs.'-C0)
Erf = 3×3
0.4286 2.5714 4.7143 0.1364 0.8182 1.5000 0.0811 0.4865 0.8919
Ratchapon Nilprapa
Ratchapon Nilprapa 2021 年 10 月 3 日
Thank you for your advise, DGM.

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeOperating on Diagonal Matrices についてさらに検索

質問済み:

2021 年 10 月 3 日

コメント済み:

2021 年 10 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by