Clear Filters
Clear Filters

How could I correct the "solve" function?

3 views (last 30 days)
KIHOON RYU
KIHOON RYU on 27 Jan 2021
Commented: Bjorn Gustavsson on 27 Jan 2021
I want to get the answer with solve function.
if I use while loop below, MATLAB returns the empty syms 0-by-1.
E = 6.00;
syms x;
%% all the variables value is assigned %%
while E >= 2.00
eq = E == E_eq + (R*T)/F*log((1-x)/x) + (R*T)/F*g*(0.5 - x);
theta = vpasolve(eq,x, [-inf inf]);
data_plot = [data_plot; E, theta];
E = E - 0.01;
end
on the other hands,
if I use this loop, it shows the answer but only in a tiny range.
while E >= 2.00
eq = E == E_eq + (R*T)/F*log((1-x)/x); %% I just delete the "(R*T)/F*g*(0.5 - x)" term.
theta = vpasolve(eq,x, [-inf inf]);
data_plot = [data_plot; E, theta];
E = E - 0.01;
end
when I calculate same function with wolfram alpha, it shows the answer around 3E-34.
is there any way to get the answer under the value 1E-35?
or, do I wrong with using solve function?
  1 Comment
Bjorn Gustavsson
Bjorn Gustavsson on 27 Jan 2021
Renormalize your equation, that is change "units", such that your solution is not so close to the finite precision smalles non-zero number.

Sign in to comment.

Answers (0)

Categories

Find more on Mathematics 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!