diff --git a/.gitignore b/.gitignore index 10039ec..ef71880 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -.octave-workspace +*.mat octave-workspace diff --git a/get_map.m b/get_map.m new file mode 100644 index 0000000..45e0b21 --- /dev/null +++ b/get_map.m @@ -0,0 +1,10 @@ +function cmap = get_map(mymap) + n = 256; % size of new color map + m = size(mymap,1); + t0 = linspace(0,1,m)'; + t = linspace(0,1,n)'; + r = interp1(t0,mymap(:,1),t); + g = interp1(t0,mymap(:,2),t); + b = interp1(t0,mymap(:,3),t); + cmap = [r,g,b]; +end \ No newline at end of file diff --git a/plotter.m b/plotter.m index e78ec19..3bb5056 100644 --- a/plotter.m +++ b/plotter.m @@ -5,7 +5,7 @@ end end -plot3(terrain(:,1),terrain(:,2),terrain(:,3),'.','markersize',12) +plot3(terrain(:,2),terrain(:,1),terrain(:,3),'.','markersize',12) hold on; surf(x,y,z); hold off; diff --git a/test.m b/test.m index 9e407b9..f48bb3c 100644 --- a/test.m +++ b/test.m @@ -1,9 +1,10 @@ 1; source multilayer_perceptron.m terrain = dlmread('terrain/terrain03.data'); -[f,fder] = activation_tanh(1); +terrain = terrain(2:end,:); +[f,fder] = activation_exp(15); net = [2,45,50,1]; -[weights,output,mse] = multilayer_perceptron_learn(terrain(:,1:2)',terrain(:,3)',net ,f,fder,.05,5e4,2e-4); +[weights,output,mse] = multilayer_perceptron_learn(terrain(:,1:2)',terrain(:,3)',net ,f,fder,.05,1e4,1e-3); x = [-3:0.01:3]; y = x; %dlmwrite('weights.csv',cell2mat(weights)); @@ -14,7 +15,9 @@ end end -plot3(terrain(:,1),terrain(:,2),terrain(:,3),'.','markersize',12) +plot3(terrain(:,2),terrain(:,1),terrain(:,3),'.','markersize',12) hold on; +mymap = [0,0,0.6;0.2,0.8,0;0.4,0.8,0;0.5,0.8,0;0.7,0.7,0;0.8,0.8,0.8;1,1,1]; +colormap(get_map(mymap)); surf(x,y,z); hold off;