%author: ankur kumar
%lorenz attractor in parallel coordinates
%equations governing Lorenz attractor from wikipedia:
% dx/dt = o(y-x)
% dy/dt = x(p-z)-y
% dz/dt = xy-bz
function main()
clc
clf
%get solutions of the differential equation sol.m
[g,h] = ode45('sol',[-10 10],[1;1;1]);
figure(1)
plot3(h(:,1),h(:,2),h(:,3))
grid on
axis square
length(h)

%parallel coordinates
ndim = length(h(1,:));
map = jet(length(h));
figure(2)
hold on
for i=1:length(h)
    plot(h(i,:),'color',map(i,:));
end
%the axes for parallel coords
axisx = [1;ndim];
axisy = [0;0];
label = [{'x1'},{'x2'},{'x3'}];
for i = 1:ndim
    axisx = [axisx,[i;i]];
    axisy = [axisy,[-40;60]];
end
line(axisx, axisy, 'color', 'b');           %draw the axes
set(gca, 'xtick',[1:1:ndim]);
set(gca, 'xticklabel', label);
hold off


