how to find f"(0) where f=y(1),f'=y(2),f"=y(3)

2 次查看(过去 30 天)
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)];

采纳的回答

Torsten
Torsten 2018-4-16
f0 = deval(sol,0);
f0(3)

Best wishes

Torsten.

更多回答(1 个)

Walter Roberson
Walter Roberson 2018-4-16
%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);

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by