• Remix
  • Share
  • New Entry

on 6 Oct 2021
  • 4
  • 53
  • 4
  • 0
  • 277
%% Lorenz attractor
% Parameters
r = 28;
s = 10;
b = 8/3;
% Timespan and initial position
T = [0 100];
P0 = ones(3,1);
% Jacobian matrix as anonymous function
J = @(T,P)[s*(P(2)-P(1)); r*P(1)-P(2)-P(1)*P(3); P(1)*P(2)-b*P(3)];
% Solving through ODE45
[T,P] = ode45(J,T,P0);
% Plot
plot3(P(:,1),P(:,2),P(:,3));
view(45,5);
[bN, bD] = rat(b);
title(['Lorenz attractor' sprintf('(\\rho = %u, \\sigma = %u, \\beta = %u/%u)',r,s,bN,bD)]);
Remix Tree
Load full remix tree