Explicit solution could not be found.. > In dsolve at 194
1 view (last 30 days)
Show older comments
siddharth tripathi
on 1 Jun 2017
Commented: Star Strider
on 9 Jul 2017
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 Comments
Accepted Answer
Star Strider
on 1 Jun 2017
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 Comments
Star Strider
on 9 Jul 2017
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')
More Answers (1)
Walter Roberson
on 2 Jun 2017
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 Comments
See Also
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!