Hello, I'm trying to solve for gamma in this equation, I was hoping if someone can help out.
considering everything else is a constant that can be put as an input.

2 Kommentare

Torsten
Torsten am 2 Dez. 2022
An analytical expression for gamma does not seem possible.
Use "fzero" or "fsolve" as numerical root finders for
left-hand side(gamma) - right-hand side(gamma) = 0
smith
smith am 2 Dez. 2022
Hello, I tried but It's not solving.
clc
clear all
dbs=5.3e-10;
das=1.01e-9;
cb=4e3;
ca=1e3;
x0 =0;
x = fsolve(@myfun,x0)
function F = myfun(x)
F = (1-erf(sqrt(x/dbs)))-(((cb/ca)*sqrt(dbs/das))*(erf(sqrt(x/das)))*(exp((x/das)-(x/dbs))));
end

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Torsten
Torsten am 2 Dez. 2022
Bearbeitet: Torsten am 2 Dez. 2022

0 Stimmen

format long
dbs=5.3e-10;
das=1.01e-9;
cb=4e3;
ca=1e3;
x0 =0;
options = optimset('TolX',1e-14,'TolFun',1e-14);
x = fsolve(@(x)myfun(x,dbs,das,cb,ca),x0,options)
Equation solved. fsolve completed because the vector of function values is near zero as measured by the value of the function tolerance, and the problem appears regular as measured by the gradient.
x =
2.980227787591144e-08
myfun(x,dbs,das,cb,ca)
ans =
-7.180679523372318e-12
function F = myfun(x,dbs,das,cb,ca)
F = (1-erf(sqrt(x/dbs)))-(((cb/ca)*sqrt(dbs/das))*(erf(sqrt(x/das)))*(exp((x/das)-(x/dbs))));
end

5 Kommentare

smith
smith am 4 Dez. 2022
What does the (-7e-12) resemble exactly ??
Walter Roberson
Walter Roberson am 4 Dez. 2022
-7e-12 is the value the function actually calculates at x. Ideally you would want it to compute exactly 0, but that is not usually realistic due to floating point round-off (and the fact that you did not use as tight a tolerance as absolutely possible.)
smith
smith am 5 Dez. 2022
is there a way to get x more accurately, because according to the background, x should be smaller in order (e-10)
Torsten
Torsten am 5 Dez. 2022
Bearbeitet: Torsten am 5 Dez. 2022
Seems your equation has multiple solutions.
A good idea is always to plot the function to have a good guess for the solution.
dbs=5.3e-10;
das=1.01e-9;
cb=4e3;
ca=1e3;
F = @(x)(1-erf(sqrt(x/dbs)))-(((cb/ca)*sqrt(dbs/das))*(erf(sqrt(x/das))).*(exp((x/das)-(x/dbs))));
x = 0:1e-12:2e-10;
plot(x,F(x))
sol = fzero(F,[0 1e-9])
sol = 4.7822e-11
F(sol)
ans = 1.2922e-09
smith
smith am 5 Dez. 2022
Thank you @Torsten!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Get Started with Control System Toolbox finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2018b

Gefragt:

am 2 Dez. 2022

Kommentiert:

am 5 Dez. 2022

Community Treasure Hunt

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

Start Hunting!

Translated by