How can I write these functions to the press
Show older comments

3 Comments
Walter Roberson
on 26 Jun 2020
I am not sure what you mean by "to the press" ?
Bilal Ates
on 26 Jun 2020
Bilal Ates
on 26 Jun 2020
Answers (1)
Ameer Hamza
on 26 Jun 2020
You can use ode45() to solve such a system of ODEs.
ic = [2; 4];
xspan = [0 1];
[x, Q] = ode45(@odeFun, xspan, ic);
y_sol = Q(:,1);
z_sol = Q(:,2);
plot(x, Q);
legend({'y', 'z'}, 'FontSize', 16);
function dQdx = odeFun(x, Q)
% Q(1) <=> y, Q(2) <=> z
y = Q(1);
z = Q(2);
dydx = -2*y + 4*exp(-x) + exp(-1000*z^2);
dzdx = -y*z^2/3;
dQdx = [dydx; dzdx];
end

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!