Explicit solution could not be found.. > In dsolve at 194
2 次查看(过去 30 天)
显示 更早的评论
here is my code :
>>sums u(t) v(t)
>>ode1= diff(u)==u^2/v - u
>>ode2= diff(v) == u^2-v
>>odes=[ode1;ode2]
0 个评论
采纳的回答
Star Strider
2017-6-1
An analytic (symbolic) solution does not exist. You must us a numeric solver.
The Code —
syms T t u(t) v(t) u0 v0 Y
Du = diff(u);
Dv = diff(v);
ode1 = Du == u^2/v - u;
ode2 = Dv == u^2-v;
[ode_vf, ode_subs] = odeToVectorField(ode1,ode2);
ode_fcn = matlabFunction(ode_vf, 'vars',{T,Y});
tspan = linspace(0, 10, 150);
icv = [0; 0]+sqrt(eps);
[t,y] = ode45(ode_fcn, tspan, icv);
figure(1)
plot(t, y)
grid
23 个评论
Star Strider
2017-7-9
My pleasure.
Here you go:
syms T t u(t) v(t) u0 v0 Y
Du = diff(u);
Dv = diff(v);
ode1 = Du == u^2/v - u;
ode2 = Dv == u^2-v;
[ode_vf, ode_subs] = odeToVectorField(ode1,ode2);
ode_fcn = matlabFunction(ode_vf, 'vars',{T,Y});
tspan = linspace(0, 10, 250);
icv = [0; 0]+sqrt(eps);
[t,y] = ode45(ode_fcn, tspan, icv);
figure(1)
plot(t, y)
grid
lgndc = sym2cell(ode_subs); % Get Substituted Variables
lgnds = regexp(sprintf('%s\n', lgndc{:}), '\n','split'); % Create Cell Array
legend(lgnds(1:end-1), 'Location','NW', 'Location','NE') % Display Legend
figure(2)
subplot(2,1,1)
plot(t, y(:,1))
title([lgnds{1} '(t)'])
xlabel('\bft\rm')
ylabel('\bfAmplitude\rm')
subplot(2,1,2)
plot(t, y(:,2))
title([lgnds{2} '(t)'])
xlabel('\bft\rm')
ylabel('\bfAmplitude\rm')
更多回答(1 个)
Walter Roberson
2017-6-2
Making the assumption that you made a minor typing mistake in entering your question, and that you are asking about
syms u(t) v(t)
ode1= diff(u)==u^2/v - u;
ode2= diff(v) == u^2-v;
odes = [ode1;ode2];
dsolve(odes)
then MATLAB is not able to provide analytic solutions. However, two analytic solutions exist:
1)
u(t) = 0
v(t) = C1 * exp(-t)
where C1 is an arbitrary constant whose value depends upon the initial conditions
2)
u(t) = RootOf(-Intat(-LambertW(-C1*exp(a_)/a_)/(a_*(LambertW(-C1*exp(a_)/a_)+1)), a_ = Z_) + t + C2)
v(t) = u(t)^2/(diff(u(t), t)+u(t))}
that ugly formula for u(t) says that there is a particular function involving a ratio of LambertW formulas, and that for any given t, u(t) is the value such that the integral of the ratio, evaluate at that value, is 0.
This is ugly. But it does provide a path to an analytic solution, of sorts. But it is beyond the capacity of MATLAB.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calculus 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!