現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
Whenever I type in syms x and run it, Matlab seems like it's being looped and I also can't stop it. How do I fix it?
5 ビュー (過去 30 日間)
古いコメントを表示
I always need to use task manager to stop Matlab because pressing X doesn't shut it down.The problem just started today and I don't now why it keeps happening.
採用された回答
Steven Lord
2018 年 5 月 5 日
18 件のコメント
Jasper Chan
2018 年 5 月 7 日
First of all I just want to say that its ridiculous that the solution to such a fundamental problem is "pay for the newer version of matlab", but I digress.
I've updated to R2018a. I'm not quite sure what R2018a Update 1 means, but the 'Check for Updates' window lists both MATLAB and the Symbolic toolbox as up to date, yet my problem still persists.
>> syms x
Error using mupadmex
Internal error with symbolic engine. Quit and restart MATLAB.
Error in sym>tomupad (line 1219)
S = mupadmex(numeric2cellstr(x));
Error in sym (line 211)
S.s = tomupad(x);
Error in syms (line 201)
toDefine = sym(zeros(1, 0));
Walter Roberson
2018 年 5 月 7 日
Dishank Mittal
2018 年 5 月 20 日
I was facing the same issue and trying to figure from 2 days. It worked finally. Thanks Walter! Cheers!
Vinayak Vadlamani
2018 年 6 月 27 日
編集済み: Walter Roberson
2018 年 6 月 27 日
Steven, I tried the fix but it doesn't seem to work. Made the 2017b update. I run LabView in parallel on this system FYI.
System Info (ver)
-----------------------------------------------------------------------------------------------------
MATLAB Version: 9.3.0.713579 (R2017b)
MATLAB License Number: ••••••••
Operating System: Microsoft Windows 10 Enterprise Version 10.0 (Build 17134)
Java Version: Java 1.8.0_121-b13 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
Steven Lord
2018 年 6 月 27 日
According to the output of the ver function that you posted you have not installed the update. I just installed the update in my installation of release R2017b and the first two lines of my ver output are:
>> ver
--------------------------------------------------
MATLAB Version: 9.3.0.867777 (R2017b) Update 7
[I trimmed some of the dashes in the divider, otherwise this post would have scroll bars.]
Filipe Lima
2018 年 7 月 17 日
>> ver
-----------------------------------------------------------------------------------------------------
MATLAB Version: 9.4.0.813654 (R2018a)
MATLAB License Number: STUDENT
Operating System: Microsoft Windows 10 Pro Version 10.0 (Build 17134)
Java Version: Java 1.8.0_144-b01 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
I have the latest version but the problem persists!
Steven Lord
2018 年 7 月 17 日
You don't have the update installed. If you did, the MATLAB Version line would include "Update" and a number after the "(R2018a)".
Open the Bug Report link and click on the "R2018a Update 1" link in the Bug Report. [That now goes to a later update than Update 1, but the later updates include all the bug fixes from previous updates for that release.] Download and install the update.
GAGANDEEP KAUR
2020 年 11 月 3 日
編集済み: Walter Roberson
2020 年 11 月 4 日
I have updated the version for R2018a but is still hving issue with the syms command , keep on running the code and not showing any result.Please if I could get some help
Here is the section I am having trouble with
syms a b c d e;
K1=zeros(1,5);K2=zeros(1,5);K3=zeros(1,5);K4=zeros(1,5);K5=zeros(1,5);
for i=1:9
%calculating mole fractions of ionic species
x1=[0.5096 0.5092 0.5087 0.4852 0.4847 0.4834 0.4804 0.4805 0.4803];
x2=[0.0963 0.0964 0.0965 0.1163 0.1161 0.1158 0.1275 0.1266 0.1253];
x3=[0.3941 0.3944 0.3948 0.3985 0.3992 0.4008 0.3921 0.3929 0.3943];
T=[394.15 399.15 404.15 375.15 390.15 405.15 374.15 392.15 406.15];
%Equilibrium constant for reaction 1 (Solvation reaction)
K1(i)=exp((-8.549)+(6692/T(i)))
%Equilibrium constant for reaction 2(Ionization of water)
K2(i)=100
%Equilibrium constant for reaction 3(Dissociation of HI)
K3(i)=exp((16.93565)+((1250)/T(i))+(-2.575*log(T(i))))
%Equilibrium constant for reaction 4(Polyiodide formation a)
K4(i)=exp((-936.28)+((40216.27)/T(i))+(151.983*(log(T(i))))+(-0.1675*(T(i))))
%Equilibrium constant for reaction 5(Polyiodide formation b)
K5(i)=exp((1044.78)+(-45171.42/T(i))+(-165.20*log(T(i)))+(0.1511*(T(i))))
eqns=[((d*(c-e))/((x1(i)-a-b-c-d)^5)*(x2(i)-d-b-c))==K1(i),((a+b+c)*a)/((x1(i)-a-b-c-d)^2)==K2(i),((a+b+c)*(d+b))/((x1(i)-a-b-c-d)*(x2(i)-d-b-c-e))==K3(i),((a+b+c)*(c-e))/((x1(i)-a-b-c-d)^4*(x2(i)-d-b-c-e))==K4(i), (((e)*(x1(i)-a-b-c-d)^3)/((c-e)*(x3(i)-e)))==K5(i)];
S=solve(eqns,[a,b,c,d,e]);
S.a(S.a<0)=[];
S.b(S.b<0)=[];
S.c(S.c<0)=[];
S.d(S.d<0)=[];
S.e(S.e<0)=[];
S.a=double(S.a)
S.b=double(S.b)
S.c=double(S.c)
S.d=double(S.d)
S.e=double(S.e)
end
Walter Roberson
2020 年 11 月 4 日
You should re-arrange.
... It will not help... but you should re-arrange.
syms a b c d e;
x1=[0.5096 0.5092 0.5087 0.4852 0.4847 0.4834 0.4804 0.4805 0.4803];
x2=[0.0963 0.0964 0.0965 0.1163 0.1161 0.1158 0.1275 0.1266 0.1253];
x3=[0.3941 0.3944 0.3948 0.3985 0.3992 0.4008 0.3921 0.3929 0.3943];
T=[394.15 399.15 404.15 375.15 390.15 405.15 374.15 392.15 406.15];
N = length(x1);
K1 = zeros(1,N);
K2 = zeros(1,5);
K3 = zeros(1,N);
K4 = zeros(1,N);
K5 = zeros(1,N);
Sout = struct();
for i=1:N
%calculating mole fractions of ionic species
%Equilibrium constant for reaction 1 (Solvation reaction)
K1(i)=exp((-8.549)+(6692/T(i)));
%Equilibrium constant for reaction 2(Ionization of water)
K2(i)=100;
%Equilibrium constant for reaction 3(Dissociation of HI)
K3(i)=exp((16.93565)+((1250)/T(i))+(-2.575*log(T(i))));
%Equilibrium constant for reaction 4(Polyiodide formation a)
K4(i)=exp((-936.28)+((40216.27)/T(i))+(151.983*(log(T(i))))+(-0.1675*(T(i))));
%Equilibrium constant for reaction 5(Polyiodide formation b)
K5(i)=exp((1044.78)+(-45171.42/T(i))+(-165.20*log(T(i)))+(0.1511*(T(i))));
eqns=[((d*(c-e))/((x1(i)-a-b-c-d)^5)*(x2(i)-d-b-c))==K1(i),((a+b+c)*a)/((x1(i)-a-b-c-d)^2)==K2(i),((a+b+c)*(d+b))/((x1(i)-a-b-c-d)*(x2(i)-d-b-c-e))==K3(i),((a+b+c)*(c-e))/((x1(i)-a-b-c-d)^4*(x2(i)-d-b-c-e))==K4(i), (((e)*(x1(i)-a-b-c-d)^3)/((c-e)*(x3(i)-e)))==K5(i)];
S=vpasolve(eqns,[a,b,c,d,e]);
mask = S.a < 0 | S.b < 0 | S.c < 0 | S.d < 0 | S.e < 0;
S.a(mask)=[];
S.b(mask)=[];
S.c(mask)=[];
S.d(mask)=[];
S.e(mask)=[];
Sout(i).a=double(S.a);
Sout(i).b=double(S.b);
Sout(i).c=double(S.c);
Sout(i).d=double(S.d);
Sout(i).e=double(S.e);
disp(Sout(i))
end
Walter Roberson
2020 年 11 月 4 日
My tests are suggesting that there might not be any positive solution.
Walter Roberson
2020 年 11 月 4 日
For the first iteration, the closest I can find to a solution so far is
0.00917672806222852 234268.624175873 -4.132761874031 -234268.627565044 5.76374428893838
Yes, this does involve some very negative numbers. When I restrict to positive values, I do not come at all close to a solution.
Walter Roberson
2020 年 11 月 4 日
It also appears that there might be fairly noticable round-off problems near that location.
GAGANDEEP KAUR
2020 年 11 月 4 日
Thank you respected Walter Roberson for your effort and time. I may need to reform this system of equations.
GAGANDEEP KAUR
2020 年 11 月 4 日
I have tried to run the code you suggested once .As you have found problem with negative values so I made it to run without this constraint and it still keep on running. On pausing it showed following message:
Operation terminated by user during mupadengine/evalin (line 123)
In mupadengine/feval (line 182)
[S,err] = evalin(engine,stmt,'message');
In sym/vpasolve (line 172)
sol = eng.feval('symobj::vpasolve',eqns,vars,X0);
In Equilibrium_constant (line 26)
S=vpasolve(eqns,[a,b,c,d,e]);
Walter Roberson
2020 年 11 月 4 日
That is the expected message when you control-c to stop execution.
vpasolve is either not able to find an answer or takes a very long time to find an answer even when I tell it to start at a position that is pretty close to working (but not quite working.) My searches have not found any solution when I confine the values to +/- 1e6. And definitely not positive values only.
By the way, the equations have a singularity when c==e, leading to +/- infinity.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Symbolic Math Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
アジア太平洋地域
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)