Nonlinear equations with two variables and a changing parameter
3 views (last 30 days)
Show older comments
Hi,
I thank you for your kind help in advance!
I am solving a system of nonlinear equations with two variable x and t, and a changing parameter V. it may be sovled using a fsolve in matlab.
Then, I want to plot a figure in which the variable x or t as a function of log(V), that is,
The nonlinear equation is desribed as below code:
%The below is a system of nonlinear equations with two variables x, t, and
%a changing parameter V. 0<x<0.2, t is around 6.3e6, 0.001<V<1.
V=logspace(-3,0,10000); % A changing parameter 0.001<V<1
T=@(x,t,V) 294+8.8e-4.*t.*V.^(0.5); %Temperature
D=@(x,t,V) 1.9e-6+4.5e-7.*erf((log10(V)-log10(0.1))/0.25); %Grain size
fn=@(x) ((0.2-x)./(x-0.02))^(-2); %porosity function in normal direction
gsg=@(x,t,V) 2.4e-10.*exp(-213e3./8.31./T(x,t,V)).*fn(x).^1.7./D(x,t,V).^3; %shear strain due to granular flow
ft=@(x) (1-x./0.2).^2; %porosity funciton in shear direcdtion
gps=@(x,t,V) 1.33e-21.*exp(-213e3./8.31./T(x,t,V)).*(ft(x).*t).^1.7./D(x,t,V).^3; %shear strain due to pressure solution
F1=@(x,t,V) 2e-5.*(gsg(x,t,V)+gps(x,t,V))-V; %velocity
F2=@(x,t,V) 1e8.*(0.867+0.01.*log(gsg(x,t,V))-1.14.*x)./(1-(0.64+0.01.*log(gsg(x,t,V)).*1.14.*(0.2-x)))-t; %shear stress
for k=1:length(V)
fun=@(x,t)[F1(x,t,V(k))
F2(x,t,V(k))];
y(k)=fzero(fun,.19999,6.3e6);%plotted to get initial guess close, function blows up belond about .2 and goes imaginary
end
figure (1)
plot(log10(V),t,'k',LineWidth=2) % I want to plot t as a function of V
0 Comments
Accepted Answer
Torsten
on 4 Nov 2022
%The below is a system of nonlinear equations with two variables x, t, and
%a changing parameter V. 0<x<0.2, t is around 6.3e6, 0.001<V<1.
V=logspace(-3,0,10); % A changing parameter 0.001<V<1
T=@(x,t,V) 294+8.8e-4.*t.*V.^(0.5); %Temperature
D=@(x,t,V) 1.9e-6+4.5e-7.*erf((log10(V)-log10(0.1))/0.25); %Grain size
fn=@(x) ((0.2-x)./(x-0.02))^(-2); %porosity function in normal direction
gsg=@(x,t,V) 2.4e-10.*exp(-213e3./8.31./T(x,t,V)).*fn(x).^1.7./D(x,t,V).^3; %shear strain due to granular flow
ft=@(x) (1-x./0.2).^2; %porosity funciton in shear direcdtion
gps=@(x,t,V) 1.33e-21.*exp(-213e3./8.31./T(x,t,V)).*(ft(x).*t).^1.7./D(x,t,V).^3; %shear strain due to pressure solution
F1=@(x,t,V) 2e-5.*(gsg(x,t,V)+gps(x,t,V))-V; %velocity
F2=@(x,t,V) 1e8.*(0.867+0.01.*log(gsg(x,t,V))-1.14.*x)./(1-(0.64+0.01.*log(gsg(x,t,V)).*1.14.*(0.2-x)))-t; %shear stress
for k=1:length(V)
fun=@(x,t,V)[F1(x,t,V)
F2(x,t,V)];
y(k,:)=fsolve(@(x)fun(x(1),x(2),V(k)),[.19999,6.3e6]);%plotted to get initial guess close, function blows up belond about .2 and goes imaginary
end
3 Comments
Torsten
on 4 Nov 2022
Either
- your starting guesses for the parameters are bad,
- you made a mistake in the implementation of the equations or
- your equations don't have a solution.
In all three cases, I cannot help you further.
More Answers (0)
See Also
Categories
Find more on Systems of Nonlinear Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!