I am very unsure of why this does not work. I want to plug in a range of Xa into V equation and plot Xa vs V
k=1; %mol3L-3sec-1
Fa0=1; %molA/sec
v0=1; %L/sec
Ca0=Fa0/v0;
Xa=(0:.05:1);
V=(Fa0-(Ca0*v0*((1-Xa)/(1-(.5*Xa)))))./(-k*((Ca0*((1-Xa)/(1-(.5*Xa)))).^-2));
plot(Xa,V);
xlabel('Conversion');
ylabel('Volume');

 採用された回答

Walter Roberson
Walter Roberson 2021 年 2 月 19 日

1 投票

k=1; %mol3L-3sec-1
Fa0=1; %molA/sec
v0=1; %L/sec
Ca0=Fa0./v0;
Xa=(0:.05:1);
V=(Fa0-(Ca0.*v0.*((1-Xa)./(1-(.5*Xa)))))./(-k.*((Ca0.*((1-Xa)./(1-(.5*Xa)))).^-2));
plot(Xa,V);
xlabel('Conversion');
ylabel('Volume');
In short: get in the habit of using ./ instead of / (except perhaps for simple fractions like 2/3 ) . The / function is not element-by-element division: it is "matrix right divide", in which A/B acts similar to A*pinv(B) where * is algebraic matrix multiplication.

1 件のコメント

Kara Scully
Kara Scully 2021 年 2 月 19 日
thank you so much! i honestly was not sure when to use ./ specifically if it had to be for like every step in the equation but now i know :)

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by