how to find f"(0) where f=y(1),f'=y(2),f"=y(3)
2 views (last 30 days)
Show older comments
dydx=[y(2); y(3); 2*a1*y(2)*(y(2)+y(5))-a1*y(3)*(y(1)+y(4));
y(5); y(6); 2*a1*y(5)*(y(2)+y(5))-a1*y(6)*(y(1)+y(4));
y(8); A*Pr*a2*y(7)*(y(2)+y(5))-Pr*a2*y(8)*(y(1)+y(4))];
res=[ya(1); ya(2)-1; ya(4); ya(5)-p; ya(7)-1; yb(2); yb(5); yb(7)];
2 Comments
Accepted Answer
More Answers (1)
Walter Roberson
on 16 Apr 2018
%construct initial values any way suitable for you
a1 = rand();
a2 = rand();
A = rand();
Pr = rand();
ya = rand(1,7);
yb = rand(1,7);
p = rand();
%now find the values
dxdy = @(t,y) [y(2); y(3); 2*a1*y(2)*(y(2)+y(5))-a1*y(3)*(y(1)+y(4));
y(5); y(6); 2*a1*y(5)*(y(2)+y(5))-a1*y(6)*(y(1)+y(4));
y(8); A*Pr*a2*y(7)*(y(2)+y(5))-Pr*a2*y(8)*(y(1)+y(4))];
res=[ya(1); ya(2)-1; ya(4); ya(5)-p; ya(7)-1; yb(2); yb(5); yb(7)];
tspan = [0 5];
[t, y] = ode45(dxdy, tspan, res);
f = y(:,1);
f_prime = y(:,2);
f_primeprime = y(:,3);
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!