Commit 663a3da6 authored by Girard Julien's avatar Girard Julien
Browse files

Problems definition file is complete

parents
function [p,n] = getProblems()
i = 1;
p = struct;
%%%%%%%%%%%%%%%%%%%%
%Non-stiff problems: B
%%%%%%%%%%%%%%%%%%%%
% B1
p(i).name = 'non_stiff-B1';
p(i).f = @(x,y) [
2*(y(1)-y(1)*y(2));
-(y(2)-y(1)*y(2))
];
p(i).h0 = -1;
p(i).y0 = [1;3];
p(i).xSpan = [0 20];
i = i + 1;
% B2
p(i).name = 'non_stiff-B2';
p(i).f = @(x,y) [
-y(1) + y(2);
y(1) - 2*y(2) + y(3);
y(2) - y(3)
];
p(i).h0 = -1;
y0 = [2;0;1];
xSpan = [0 20];
i = i + 1;
% B3
p(i).name = 'non_stiff-B3';
p(i).f = @(x,y) [
-y(1);
y(1) - y(2)^2;
y(2)^2
];
p(i).h0 = -1;
y0 = [2;0;1];
xSpan = [0 20];
i = i + 1;
% return value
n = i-1;
% B4
p(i).name = 'non_stiff-B4';
p(i).f = @(x,y) [
-y(2)-y(1)*y(3)/((y(1)^2+y(2)^2)^(1/2));
y(1) - y(2)*y(3)/((y(1)^2+y(2)^2)^(1/2));
y(1)/((y(1)^2+y(2)^2)^(1/2))
];
p(i).y0 = [3;0;0];
p(i).h0 = -1;
p(i).xSpan = [0 20];
i = i + 1;
% B5
p(i).name = 'non_stiff-B5';
p(i).f = @(x,y) [
y(2)*y(3);
-y(1)*y(3);
-0.51*y(1)*y(2)
];
p(i).y0 = [0;1;1];
p(i).h0 = -1;
p(i).xSpan = [0 20];
i = i + 1;
%%%%%%%%%%%%%%%%%%%%
%Stiff problems: B
%%%%%%%%%%%%%%%%%%%%
% Bl
p(i).name = 'stiff-B1';
p(i).f = @(x,y) [
-y(l) + y(2);
-100*y(1) - y(2);
-100*y(3)+y(4);
-10000*y(3)-100*y(4)
];
p(i).y0= [1;0;1;0];
p(i).h0= 7*10^(-3);
p(i).xSpan = [0 20];
i = i + 1;
% B2
alpha = 3;
p(i).name = 'stiff-B2';
p(i).f = @(x,y) [
-10*y(l) + alpha*y(2);
-alpha*y(1) - 10*y(2);
-4*y(3);
-4*y(4);
-0.5*y(5);
-0.1*y(6)
];
p(i).y0= [1;1;1;1;1;1];
p(i).h0= 10^(-2);
p(i).xSpan = [0 20];
i = i + 1;
% B3
alpha = 8;
p(i).name = 'stiff-B3';
p(i).f = @(x,y) [
-10*y(l) + alpha*y(2);
-alpha*y(1) - 10*y(2);
-4*y(3);
-4*y(4);
-0.5*y(5);
-0.1*y(6)
];
p(i).y0= [1;1;1;1;1;1];
p(i).h0= 10^(-2);
p(i).xSpan = [0 20];
i = i + 1;
% B4
alpha = 25;
p(i).name = 'stiff-B4';
p(i).f = @(x,y) [
-10*y(l) + alpha*y(2);
-alpha*y(1) - 10*y(2);
-4*y(3);
-4*y(4);
-0.5*y(5);
-0.1*y(6)
];
p(i).y0= [1;1;1;1;1;1];
p(i).h0= 10^(-2);
p(i).xSpan = [0 20];
i = i + 1;
% B5
alpha = 100;
p(i).name = 'stiff-B5';
p(i).f = @(x,y) [
-10*y(l) + alpha*y(2);
-alpha*y(1) - 10*y(2);
-4*y(3);
-4*y(4);
-0.5*y(5);
-0.1*y(6)
];
p(i).y0= [1;1;1;1;1;1];
p(i).h0= 10^(-2);
p(i).xSpan = [0 20];
i = i + 1;
end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment