Error using mupadengine/feval (line 187) Invalid equations.
18 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Lada Nuzhna
am 28 Dez. 2019
Kommentiert: Lada Nuzhna
am 1 Jan. 2020
I am trying to solve a differential equation, but getting the following error
Error using mupadengine/feval (line 187)
Invalid equations.
My code:
syms r(P);
eqn = diff(r,P,2) == (r^4 / b^2) - (1-k/r)*(r^4/a^2 + r^2);
Dr = diff(r,P);
cond = [ r(0) == 0.1, Dr(0) == 0.1];
rsol(P) = dsolve(eqn ,[0 10], cond);
All the variables used (a,k,b) are defined in the code before.
Will be grateful for any help!
0 Kommentare
Akzeptierte Antwort
Jyothis Gireesh
am 31 Dez. 2019
I am assuming here that you want the solution to be evaluated over the range [0 10]. But according to MATLAB documentation, the "dsolve()" doesn’t provide the functionality to provide that as an input argument to the function.
I tried running the above code by initializing the values of "a", "b" and "k" with value 1 which didn't yield an explicit solution. In case such a situation arises, it may be better to use numerical integration techniques as ode45. The following code may be useful in case of numerical methods
clear;
syms r(p)
a=2;
b=1;
k=1;
eqn = diff(r,p,2) == r^4/b^2 - (1-k/r)*(r^4/a^2 + r^2);
Dr = diff(r,p);
V = odeToVectorField(eqn);
F = matlabFunction(V, 'vars', {'p','Y'});
rsol = ode45(F,[0 10], [0.1 0.1])
Hope this helps!
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Applications finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!