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

Declare what function we will use at one point

parent ed2e5997
No related branches found
No related tags found
No related merge requests found
...@@ -13,6 +13,7 @@ b=[ ...@@ -13,6 +13,7 @@ b=[
1 1
2.5 2.5
]; ];
func = 'S'; % steepFunctionNonsmooth
x = -.1:.005:.4; x = -.1:.005:.4;
y = .9:.005:1.1; y = .9:.005:1.1;
...@@ -23,7 +24,7 @@ ylabel('y') ...@@ -23,7 +24,7 @@ ylabel('y')
tic tic
for i=1:length(y) for i=1:length(y)
in = [ X(i,:); Y(i,:) ]; in = [ X(i,:); Y(i,:) ];
f(i,:) = duneevaluate(A,b, 'S', in); f(i,:) = duneevaluate(A,b,func, in);
end end
clear X Y; clear X Y;
toc toc
...@@ -40,11 +41,11 @@ vecs(2,:) = [0; 1]; % Start ...@@ -40,11 +41,11 @@ vecs(2,:) = [0; 1]; % Start
for j = 2:steps+1 % Something random for j = 2:steps+1 % Something random
% Zero is code for 'SteepFunctionNonsmooth' % Zero is code for 'SteepFunctionNonsmooth'
vecs(j+1,:) = duneminimise(A,b, 'S', vecs(j,:)); vecs(j+1,:) = duneminimise(A,b,func,vecs(j,:));
diffs(j,:) = vecs(j+1,:) - vecs(j,:); diffs(j,:) = vecs(j+1,:) - vecs(j,:);
line([vecs(j,1) vecs(j+1,1)], ... line([vecs(j,1) vecs(j+1,1)], ...
[vecs(j,2) vecs(j+1,2)], ... [vecs(j,2) vecs(j+1,2)], ...
[duneevaluate(A,b, 'S', vecs(j,:)') duneevaluate(A,b, 'S', vecs(j+1,:)')], ... [duneevaluate(A,b,func,vecs(j,:)') duneevaluate(A,b,func,vecs(j+1,:)')], ...
'color', 'y'); 'color', 'y');
end end
......
...@@ -13,6 +13,7 @@ b=[ ...@@ -13,6 +13,7 @@ b=[
1 1
2 2
]; ];
func = 's'; % sampleFunction
x = -50:1:300; x = -50:1:300;
y = -125:1:50; y = -125:1:50;
...@@ -23,7 +24,7 @@ ylabel('y') ...@@ -23,7 +24,7 @@ ylabel('y')
tic tic
for i=1:length(y) for i=1:length(y)
in = [ X(i,:); Y(i,:) ]; in = [ X(i,:); Y(i,:) ];
f(i,:) = duneevaluate(A,b, 's', in); f(i,:) = duneevaluate(A,b,func,in);
end end
clear X Y; clear X Y;
toc toc
...@@ -40,11 +41,11 @@ vecs(2,:) = [279; 0]; % Start ...@@ -40,11 +41,11 @@ vecs(2,:) = [279; 0]; % Start
for j = 2:steps+1 % Something random for j = 2:steps+1 % Something random
% One is code for 'SampleFunction' % One is code for 'SampleFunction'
vecs(j+1,:) = duneminimise(A,b, 's', vecs(j,:)); vecs(j+1,:) = duneminimise(A,b,func,vecs(j,:));
diffs(j,:) = vecs(j+1,:) - vecs(j,:); diffs(j,:) = vecs(j+1,:) - vecs(j,:);
line([vecs(j,1) vecs(j+1,1)], ... line([vecs(j,1) vecs(j+1,1)], ...
[vecs(j,2) vecs(j+1,2)], ... [vecs(j,2) vecs(j+1,2)], ...
[duneevaluate(A,b, 's', vecs(j,:)') duneevaluate(A,b, 's', vecs(j+1,:)')], ... [duneevaluate(A,b,func,vecs(j,:)') duneevaluate(A,b,func,vecs(j+1,:)')], ...
'color', 'y'); 'color', 'y');
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment