From 625773071125f41ec93383179699b74df15fb1bd Mon Sep 17 00:00:00 2001 From: ponsfrilus Date: Thu, 16 Jul 2015 14:05:57 +0200 Subject: [PATCH] new demo --- octave_scr/cloud.m | 12 ++++++++++++ octave_scr/flower.m | 12 ++++++++++++ octave_scr/plane.m | 23 +++++++++++++++++++++++ octave_scr/spiral.m | 12 ++++++++++++ octave_scr/swissroll.m | 17 +++++++++++++++++ 5 files changed, 76 insertions(+) create mode 100644 octave_scr/cloud.m create mode 100644 octave_scr/flower.m create mode 100644 octave_scr/plane.m create mode 100644 octave_scr/spiral.m create mode 100644 octave_scr/swissroll.m diff --git a/octave_scr/cloud.m b/octave_scr/cloud.m new file mode 100644 index 0000000..1f6191e --- /dev/null +++ b/octave_scr/cloud.m @@ -0,0 +1,12 @@ +t=linspace(0,5*pi,400); + +x = 5 .* cos(t) - cos(5.*t); +y = 5 .* sin(t) - sin(5.*t); +z = t; + +D = [x; y; z]; +dlmwrite('cloud3D.txt',D',"delimiter"," "); + +plot3(x,y,z,'+b'); +pause + diff --git a/octave_scr/flower.m b/octave_scr/flower.m new file mode 100644 index 0000000..2b775f9 --- /dev/null +++ b/octave_scr/flower.m @@ -0,0 +1,12 @@ +t=linspace(0,4*pi,400); + +x = 2 .* sin(3.*t) .* cos(t); +y = 2 .* sin(3.*t) .* sin(t); +z = sin(3.*t); + +D = [x; y; z]; +dlmwrite('flower3D.txt',D',"delimiter"," "); + +plot3(x,y,z,'-r'); +pause + diff --git a/octave_scr/plane.m b/octave_scr/plane.m new file mode 100644 index 0000000..5929035 --- /dev/null +++ b/octave_scr/plane.m @@ -0,0 +1,23 @@ + +w = linspace(0,1,20); +w = w'; +x = w; + +y = zeros(400,1); + +for i=2:20 + x = [x; w]; +end + +for i=1:19 + y(i+(i-1)*20:i+(i-1)*20+19) = w(i); +end + +z = 1 - x - y; + +D = [x y z]; + +dlmwrite('plane.txt',D,"delimiter"," "); + +plot3(x(1:100), y(1:100),z(1:100),'+r',x(101:200), y(101:200),z(101:200),'+c',x(201:300), y(201:300),z(201:300),'+g',x(301:400), y(301:400),z(301:400),'+b'); +pause diff --git a/octave_scr/spiral.m b/octave_scr/spiral.m new file mode 100644 index 0000000..7b49000 --- /dev/null +++ b/octave_scr/spiral.m @@ -0,0 +1,12 @@ +t=linspace(0,7*pi,400); + +x = t; +y = t.*cos(t); +z = t.*sin(t); + +D = [x; y; z]; +dlmwrite('spiral3D.txt',D',"delimiter"," "); + +plot3(x,y,z,'+r'); +pause + diff --git a/octave_scr/swissroll.m b/octave_scr/swissroll.m new file mode 100644 index 0000000..bd4cf93 --- /dev/null +++ b/octave_scr/swissroll.m @@ -0,0 +1,17 @@ +N = 1000; + +r=linspace(0,1,N); + +t = (3*pi/2)*(0.5+1.7*r); +x1 = t.*cos(t); +y1 = t.*sin(t); +z1 = 35*rand(1,N); + +figure(1); +plot3(x1(1:250), y1(1:250), z1(1:250),'+r',x1(251:500), y1(251:500), z1(251:500),'+c',x1(501:750), y1(501:750), z1(501:750),'+g',x1(751:1000), y1(751:1000), z1(751:1000),'+b'); + +D = [x1; y1; z1]; +dlmwrite('swiss_roll.txt',D',"delimiter"," "); + +pause +