I am getting the error message "unable to find symbolic solution" using dsolve.
28 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I am using the same process that I have been using to solve differential equations, with the exception of the a substitution (I have three sets of initial conditions). I think it might have something to do with the variable being inside two different trig functions, but I am not entirely sure, as I have not solved an equation like this before. The type of output I'm looking for is an equation that I can clean up and plot for theta versus t. What exactly am I doing wrong? Is there a better way to solve this?
The outputs I am getting are:
sola =
[ empty sym ]
syms theta(t) a t
Dtheta = diff(theta,t,1);
D2theta = diff(theta,t,2);
L = 1;
g = 9.81;
ode = L*D2theta + g*sin(theta) == a*cos(theta);
cond0a = Dtheta(0) == 0.5;
cond0b = Dtheta(0) == 3;
cond0c = Dtheta(0) == 3;
cond1 = theta(0) == 0;
condsa = [cond0a, cond1];
condsb = [cond0b, cond1];
condsc = [cond0c, cond1];
aa = 5;
ab = 5;
ac = 0.5*t;
sola = dsolve(subs(ode,a,aa),condsa)
solb = dsolve(subs(ode,a,ac),condsb)
solc = dsolve(subs(ode,a,ac),condsc)
1 Commento
Walter Roberson
il 30 Nov 2024 alle 21:45
Modificato: Walter Roberson
il 30 Nov 2024 alle 21:46
syms theta(t) a t
Dtheta = diff(theta,t,1);
D2theta = diff(theta,t,2);
L = 1;
g = 9.81;
ode = L*D2theta + g*sin(theta) == a*cos(theta);
cond0a = Dtheta(0) == 0.5;
cond0b = Dtheta(0) == 3;
cond0c = Dtheta(0) == 3;
cond1 = theta(0) == 0;
condsa = [cond0a, cond1];
condsb = [cond0b, cond1];
condsc = [cond0c, cond1];
aa = 5;
ab = 5;
ac = 0.5*t;
eqn1 = subs(ode,a,aa); disp(char(eqn1))
sol1 = dsolve(eqn1); disp(char(sol1))
The dsolve() unconstrained results in a pair of solutions, both of which are constants. Those constant solutions do not meet the constraints, so dsolve() with constraints returns empty.
Risposte (1)
Torsten
il 30 Nov 2024 alle 21:46
Spostato: Torsten
il 30 Nov 2024 alle 21:50
What exactly am I doing wrong?
Nothing. "dsolve" is simply not able to find an analytical solution because the problem is too difficult.
Is there a better way to solve this?
Use a numerical solver (like ode45).
L = 1;
g = 9.81;
a = 5;
fun = @(t,y) [y(2);(-g*sin(y(1))+a*cos(y(1)))/L];
tspan = [0 5];
y0 = [0;0.5];
[T,Y] = ode45(fun,tspan,y0);
plot(T,Y(:,1))
0 Commenti
Vedere anche
Categorie
Scopri di più su Equation Solving in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!