I am getting the error message "unable to find symbolic solution" using dsolve.
5 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
Walter Roberson
2024 年 11 月 30 日
編集済み: Walter Roberson
2024 年 11 月 30 日
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.
回答 (1 件)
Torsten
2024 年 11 月 30 日
移動済み: Torsten
2024 年 11 月 30 日
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 件のコメント
参考
カテゴリ
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!