2nd order diff equation for ode23/45?
Show older comments
I have spent hours trying to figure out why I'm not getting the correct answer.

%xy''-y'-8*x^3*y^3=0
%y''= y'/x + 8y^3x^2
% y'= a(1)
% y=a(2)
%y''(x) = a(1)/x + 8*(a(2)^3)*(a(1)^2)
y2p = @(x,a) [a(2); a(1)/x + 8*(a(2)^3)*(a(1)^2)];
tspan = [1 4];
y0 = [0.5 -0.5]
[y,yPrime]=ode23(y2p,tspan,y0)
%plot(y,yPrime)
[y2,y2Prime]=ode45(y2p,tspan,y0)
%plot(y2,y2Prime)
%exact solution
1/(1+1^2) %.5 at x=1
1/(1+4^2) %.0588 at x=4
Accepted Answer
More Answers (0)
Categories
Find more on Ordinary Differential Equations 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!