Skip to content

Instantly share code, notes, and snippets.

@rakaar
Created November 1, 2021 05:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rakaar/1cd5a25a694a048dae3ff8e2ed95b7b0 to your computer and use it in GitHub Desktop.
Save rakaar/1cd5a25a694a048dae3ff8e2ed95b7b0 to your computer and use it in GitHub Desktop.
ABC flow 2 D
function abc
[x,y] = meshgrid(linspace(0,100), linspace(0,100));
dx_dt = cos(x);
dy_dt = 1 + sin(x);
figure(1)
quiver(x,y, dx_dt, dy_dt, 1, 'color',[0 0 0]);
grid
figure(2)
[t,r] = ode23(@diffeqn_abc,[0 100],[50 50]);
plot(r(:,1), r(:,2));
grid
figure(3)
[t,r] = ode23(@diffeqn_abc,[0 100],[1 1]);
plot(t, r(:,1));
grid
figure(4)
[t,r] = ode23(@diffeqn_abc,[0 100],[1 1]);
plot(t, r(:,2));
grid
end
function result = diffeqn_abc(t,r)
% r(1) = x, r(2) = y
result = zeros(2,1);
result(1) = cos(r(2));
result(2) = 1 + sin(r(1));
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment