Clear Filters
Clear Filters

Nonlinear equations with two variables and a changing parameter

3 views (last 30 days)
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

Accepted Answer

Torsten
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
No solution found. fsolve stopped because the relative size of the current step is less than the value of the step size tolerance squared, but the vector of function values is not near zero as measured by the value of the function tolerance. No solution found. fsolve stopped because the relative size of the current step is less than the value of the step size tolerance squared, but the vector of function values is not near zero as measured by the value of the function tolerance. No solution found. fsolve stopped because the relative size of the current step is less than the value of the step size tolerance squared, but the vector of function values is not near zero as measured by the value of the function tolerance. No solution found. fsolve stopped because the relative size of the current step is less than the value of the step size tolerance squared, but the vector of function values is not near zero as measured by the value of the function tolerance. No solution found. fsolve stopped because the relative size of the current step is less than the value of the step size tolerance squared, but the vector of function values is not near zero as measured by the value of the function tolerance. No solution found. fsolve stopped because the relative size of the current step is less than the value of the step size tolerance squared, but the vector of function values is not near zero as measured by the value of the function tolerance. No solution found. fsolve stopped because the last step was ineffective. However, the vector of function values is not near zero, as measured by the value of the function tolerance. No solution found. fsolve stopped because the relative size of the current step is less than the value of the step size tolerance squared, but the vector of function values is not near zero as measured by the value of the function tolerance. No solution found. fsolve stopped because the last step was ineffective. However, the vector of function values is not near zero, as measured by the value of the function tolerance. No solution found. fsolve stopped because the last step was ineffective. However, the vector of function values is not near zero, as measured by the value of the function tolerance.
  3 Comments
Torsten
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.

Sign in to comment.

More Answers (0)

Categories

Find more on Systems of Nonlinear Equations in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!