How to solve 2 equations with 2 unknown variables and plot the result?
3 次查看(过去 30 天)
显示 更早的评论
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))
%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;
S=solve(E,a,qfout)
plot(alpha,a)
0 个评论
采纳的回答
KSSV
2021-12-6
You need to convert the sym class to double using double.
plot(double(alpha),double(E))
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calculus 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!