Skip to content

Commit

Permalink
fix plot order + colormap
Browse files Browse the repository at this point in the history
  • Loading branch information
lmarzora committed May 15, 2017
1 parent 0f589b4 commit b967eeb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
.octave-workspace
*.mat
octave-workspace
10 changes: 10 additions & 0 deletions get_map.m
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion plotter.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
9 changes: 6 additions & 3 deletions test.m
Original file line number Diff line number Diff line change
@@ -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));
Expand All @@ -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;

0 comments on commit b967eeb

Please sign in to comment.