MATLAB: Change of boundary condition

boundary conditionjacobian finite differencenewton iteration

Attached is a long code of a mathematical problem in modeling.
If I want to change r(1)=ya(2)-t^alpha with alpha given, can you please help define t so that it is the same as t in the main loop while?

Best Answer

Change
Phig=gamma*(Vol+2*C*Leak)-t;Phib=GS(y(:,1),y(:,N),tipVal);
to
Phig = gamma*(Vol+2*C*Leak) - t;
Phib = GS(y(:,1), y(:,N), tipVal, t);
Change
function r=GS(ya,yb,tipVal)
r(1)=ya(2)-1;r(2)=yb(1)-tipVal;end
to
function r = GS(ya, yb, tipVal, t)
alpha = 1/3; %or 3/8. Or whatever is appropriate
r(1) = ya(2) - t.^alpha;
r(2) = yb(1) - tipVal;
end