Skip to content
Snippets Groups Projects
Commit 96f29994 authored by Elias Pipping's avatar Elias Pipping Committed by Elias Pipping
Browse files

Optimise both the plot and it computation

parent 2a48c53f
No related branches found
No related tags found
No related merge requests found
......@@ -5,18 +5,19 @@ close all
if exist('graphics_toolkit','file') graphics_toolkit('fltk') end
x = -200:2:300;
y = -200:2:300;
x = -50:1:300;
y = -125:1:50;
[X, Y] = meshgrid(x,y);
xlabel('x')
ylabel('y')
for i=1:length(x)
for j=1:length(y)
vec = [ X(i,j); Y(i,j) ];
f(i,j) = duneevaluate(vec);
for i=1:length(y)
for j=1:length(x)
f(i,j) = duneevaluate([ X(i,j); Y(i,j) ]);
end
end
clear X Y;
axis([-10, 10, -10, 10]);
surf(x, y, f)
hold on;
......@@ -32,12 +33,15 @@ for i = 1:10 # Something random
'color', 'r');
printf("Norm of step: %f\n", norm(newdiff));
if (i != 1)
printf("Angle between steps: %f degrees\n", acos( dot(olddiff,newdiff) / (norm(olddiff) * norm(newdiff)) ) / pi * 180);
printf("Angle between steps: %f degrees\n", ...
acos( dot(olddiff,newdiff) / (norm(olddiff) * norm(newdiff)) ) / pi * 180);
end
oldvec=newvec;
olddiff=newdiff;
end
axis tight;
xlabel x;
ylabel y;
hold off;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment