フィルターのクリア

How to solve 2 equations with 2 unknown variables and plot the result?

3 ビュー (過去 30 日間)
Nabilla Dewi Septiani
Nabilla Dewi Septiani 2021 年 12 月 6 日
I have this code to solve 2 equations with 2 unknown variables. And there are 2 known variables that is in a range. It gives the result but only one, where I expect it to be in a range too. Also, I could not plot it.
%Parameters
xin=0.2; xout=0.1; Pr=0.3; qf=1;
x=0:0.1:1;
alpha=0:100:1000;
%For Cross-Flow Module (CF)
y=(1+(x+Pr).*(alpha-1))-((1+(x+Pr).*(alpha-1)).^2-(4.*alpha.*(alpha-1).*x.*Pr)).^0.5/(2.*Pr.*(alpha-1))
y = 1×11
1.0e+03 * -0.0001 0.0398 0.0997 0.1796 0.2795 0.3994 0.5393 0.6992 0.8791 1.0790 1.2989
%qfout-qf=-(1-Pr+((alpha-1).*(x-Pr.*y)))*a
%x-xin=(-(1/qf).*(alpha.*(x-(Pr.*y))*a)+(-x.*ln(qfout/qf))
syms a qfout
E=-(1-Pr+((alpha-1).*(x-Pr.*y)))*a==qfout-qf , (-(1/qf).*alpha.*(x-(Pr.*y))*a)+(-x.*log(qfout/qf))==x-xin;
E = 
S=solve(E,a,qfout)
S = struct with fields:
a: 0 qfout: 1
plot(alpha,a)
Error using plot
Data must be numeric, datetime, duration or an array convertible to double.

採用された回答

KSSV
KSSV 2021 年 12 月 6 日
You need to convert the sym class to double using double.
plot(double(alpha),double(E))
  1 件のコメント
Nabilla Dewi Septiani
Nabilla Dewi Septiani 2021 年 12 月 9 日
Thank you sir. I can plot it now
But how to get the value for each array? As I only got one result and it is zero

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNumber Theory についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by