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

Add a horrible test case

parent 30b4c732
No related branches found
No related tags found
No related merge requests found
% -*- mode:octave -*-
clear all
close all
if exist('graphics_toolkit','file') graphics_toolkit('fltk') end
A=[
1 0
0 1
];
b=[
1
2.5
];
x = -.1:.005:.4;
y = .9:.005:1.1;
[X, Y] = meshgrid(x,y);
xlabel('x')
ylabel('y')
tic
for i=1:length(y)
in = [ X(i,:); Y(i,:) ];
f(i,:) = duneevaluate(A,b, 'S', in);
end
clear X Y;
toc
surf(x, y, f)
hold on;
steps = 1100;
vecs = zeros(steps + 1, 2);
diffs = zeros(steps, 2);
vecs(1,:) = [0; 0]; % So that we can always calculate a difference
vecs(2,:) = [0; 1]; % Start
for j = 2:steps+1 % Something random
% Zero is code for 'SteepFunctionNonsmooth'
vecs(j+1,:) = duneminimise(A,b, 'S', vecs(j,:));
diffs(j,:) = vecs(j+1,:) - vecs(j,:);
line([vecs(j,1) vecs(j+1,1)], ...
[vecs(j,2) vecs(j+1,2)], ...
[duneevaluate(A,b, 'S', vecs(j,:)') duneevaluate(A,b, 'S', vecs(j+1,:)')], ...
'color', 'y');
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