フィルターのクリア

Error using matlab.ui.​control.in​ternal.mod​el.Abstrac​tNumericCo​mponent/se​t.Value (line 111) 'Value' must be a double scalar.

3 ビュー (過去 30 日間)
Hi, I'm working on an app and I keep getting the message: Error using matlab.ui.control.internal.model.AbstractNumericComponent/set.Value (line 111) 'Value' must be a double scalar.
Here is the portion of my script that gets the error:
syms x
eqn = log(molD/1)==((1/alphaAB)*...
(log((x*(1-xi))/(xi*(1-x)))))+...
log((1-xi)/(1-x));
xD = solve(eqn,x);
app.xDmolfrField.Value = xD; %this line gets the error
app.ximolfrField.Value = xi-xD;
Then I inserted the "double()" to correct it but I still get the same error.
Here's my edited script:
syms x
eqn = log(molD/1)==((1/alphaAB)*...
(log((x*(1-xi))/(xi*(1-x)))))+...
log((1-xi)/(1-x));
xD = solve(eqn,x);
app.xDmolfrField.Value = double(xD); %this line still gets the error
app.ximolfrField.Value = xi-double(xD);
I need this as soon as possible... thank you in advance!

回答 (1 件)

Walter Roberson
Walter Roberson 2021 年 8 月 7 日
molD = rand()
molD = 0.2452
alphaAB = 5*rand()
alphaAB = 3.1284
xi = rand()
xi = 0.9372
syms x
eqn = log(molD/1)==((1/alphaAB)*...
(log((x*(1-xi))/(xi*(1-x)))))+...
log((1-xi)/(1-x))
eqn = 
xDn = vpasolve(eqn,x)
xDn = 
0.82341997811071473875089180962197
xD = solve(eqn,x)
Error using mupadengine/feval_internal
Out of memory.

Error in sym/solve (line 293)
sol = eng.feval_internal('solve', eqns, vars, solveOptions);
When you run out of memory, there would be no answer...
Even if you do not run out of memory, it is pretty likely that it will not be able to come up with an exact solution.
vpasolve() does not have any problem with the situation though.
  5 件のコメント
Walter Roberson
Walter Roberson 2021 年 8 月 7 日
So the vpasolve failed. Possibly one of the inputs is empty, or perhaps it just cannot find a solution. You should attach a mat file with the values of your variables. (class of variables and all digits might be important so please do not just show the variables in text form)

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeNumeric Solvers についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by