- #1
squenshl
- 479
- 4
Homework Statement
Approximate y by a cubic polynomial on each of the sub-intervals [0,1/2] & [1/2,1] and then solve the collocation problem.
Approximate y by a cubic polynomial on each of the sub-intervals [0,1/4], [1/4,1/2], [1/2,3/4], [3/4,1] and then solve the collocation problem.
Homework Equations
The Attempt at a Solution
I have written the files below. Also:
function yp = f(x,y)
yp = 3/2*y.^2;
The fd_jac(x) file as in my other example.
I have an example of a function y = r(a)
function y = r(a)
x = [0.2 0.4 0.6 0.8]';
x0 = 0; xf = 1;
y0 = 4; yf = 1;
length(a)
y(1) = y0 - p(a,x0);
y(2:5) = ppp(a,x) - f(x,p(a,x));
y(6) = yf - p(a,xf);
y = y';
Please help.