nonlinear equations system with a changing parameter

Hi,
I thank you for your kind help in advance!
I am solving the nonlinear equations with one variable (x) and a changing parameter (T).
Then, I want to plot a figure in which the variable is a function of T, that is,
The nonlinear equation is desribed as below code:
syms T %T is a changing parameters (Kelvin temperature varies from 300 to 1000)
x = linspace(0,0.2,10000); % x is an independent variable from 0 to 0.2
% below is a system of nonlinear equations, but only an independent variable
% and an independent changing parameter Va
A =3.8e-4./T./(0.4-2.*x).^3;
B = 5e7.*(0.83-1.154.*x+1.7e-5.*T.*(log(A)+3.912))./(1-(0.2308-1.154.*x).*(0.6+1.7e-5.*T.*(log(A)+3.912)));
C = 4.38e-12.*B./T./(0.4-2.*x).^2;
D = 2.11e-12.*B./T;
5e-5.*(A+C)+7.5e-4.*D=1e-6;
% T is a changing parameter, 300<T<1000;
% I want to plot a figure in which B as a function of T
plot (T, B./5e7, 'k-')

 采纳的回答

A =@(x,T)3.8e-4./T./(0.4-2.*x).^3;
B =@(x,T) 5e7.*(0.83-1.154.*x+1.7e-5.*T.*(log(A(x,T))+3.912))./(1-(0.2308-1.154.*x).*(0.6+1.7e-5.*T.*(log(A(x,T))+3.912)));
C =@(x,T)4.38e-12.*B(x,T)./T./(0.4-2.*x).^2;
D =@(x,T) 2.11e-12.*B(x,T)./T;
E =@(x,T) 5e-5.*(A(x,T)+C(x,T))+7.5e-4.*D(x,T)-1e-6;
T=300:1000;
for k=1:length(T)
fun=@(x)E(x,T(k));
y(k)=fzero(fun,.179);%plotted to get initial guess close, function blows up belond about .2 and goes imaginary
end
plot(T,y)

1 个评论

@David Hill thank you very much for your kind help! it is almost what i want.
To get T vs B, I just replaced
plot (T,y)
with
plot(T,(0.83-1.154.*y+1.7e-5.*T.*(log(3.8e-4./T./(0.4-2.*y).^3)+3.912))./(1-(0.2308-1.154.*y).*(0.6+1.7e-5.*T.*(log(3.8e-4./T./(0.4-2.*y).^3)+3.912))))
% i.e.,
plot(T,B./5e7)

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Systems of Nonlinear Equations 的更多信息

产品

版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by