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-')

 Accepted Answer

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 Comment

@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)

Sign in to comment.

More Answers (0)

Categories

Products

Release

R2021a

Asked:

on 26 Oct 2022

Commented:

on 27 Oct 2022

Community Treasure Hunt

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

Start Hunting!