From 34809281a592246a06347608e6149a7c5b36d798 Mon Sep 17 00:00:00 2001 From: Elias Pipping <elias.pipping@fu-berlin.de> Date: Thu, 2 Aug 2012 12:17:22 +0200 Subject: [PATCH] Plot the surface as well --- src/test_circle_1.m | 16 ++++++++++++++-- src/test_circle_10.m | 16 +++++++++++++++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/test_circle_1.m b/src/test_circle_1.m index a3fa0504..a14afb42 100644 --- a/src/test_circle_1.m +++ b/src/test_circle_1.m @@ -1,3 +1,5 @@ +clear all; + if exist('graphics_toolkit','file') graphics_toolkit('fltk') end @@ -16,11 +18,21 @@ y = scale*sin(t); z = arrayfun(@(vec1, vec2) J([vec1; vec2]), x, y); hold on -plot3(x,y,z); +plot3(x,y,z,'k'); title 'scale = 1' # Minimum taken from test-circle.cc with scale=1 plot3(-1.487905e-01, +9.888687e-01, J([-1.487905e-01; +9.888687e-01]), 'r+'); -hold off + +x = scale * (-1:.05:1); +y = scale * (-1:.05:1); +[X, Y] = meshgrid(x,y); + +for i=1:length(y) + val(i,:) = arrayfun(@(vec1, vec2) J([vec1; vec2]), X(i,:), Y(i,:)); +end + +surf(x, y, val) +hold off; diff --git a/src/test_circle_10.m b/src/test_circle_10.m index 18f1150f..22224cc5 100644 --- a/src/test_circle_10.m +++ b/src/test_circle_10.m @@ -1,3 +1,5 @@ +clear all; + if exist('graphics_toolkit','file') graphics_toolkit('fltk') end @@ -15,7 +17,8 @@ x = scale*cos(t); y = scale*sin(t); z = arrayfun(@(vec1, vec2) J([vec1; vec2]), x, y); -plot3(x,y,z); +hold on +plot3(x,y,z,'k'); title 'scale = 10' @@ -24,3 +27,14 @@ title 'scale = 10' line([-5.3444 6.36022], [8.45206 -7.71671], [J([-5.3444; 8.45206]) J([6.36022; -7.71671])]) + +x = scale * (-1:.05:1); +y = scale * (-1:.05:1); +[X, Y] = meshgrid(x,y); + +for i=1:length(y) + val(i,:) = arrayfun(@(vec1, vec2) J([vec1; vec2]), X(i,:), Y(i,:)); +end + +surf(x, y, val) +hold off; -- GitLab