MATLAB: Error using ==> inline.subsref at 14 Not enough inputs to inline function.

i need f as function of h

hi guys
Please if anyone can help me with my code. i face an error that says
**Error using ==> inline.subsref at 14
Not enough inputs to inline function.
x1=-4; x2=5;
F=inline('4*(sqrt(x1^2 + (10-x2)^2 )-10)^2 + 0.5*(sqrt(x1^2 + (10+x2)^2 )-10)^2 -5*(x1+x2)','x1','x2');
for j=1:200
s1=-dF1;
s2=-dF2;% dF1,dF2 can be found
x3=x1+s1*h;
x4=x2+s2*h;
%the problem is i want to use inline function as function of (h).
g=4*(sqrt(x1^3 + (10-x4)^2 )-10)^2 + 0.5*(sqrt(x3^2 + (10+x4)^2 )-10)^2 -5*(x3+x4).
f=inline('g','h');
% later in my loop i will use f(a) where a is known but i always got
*** Error using ==> inline.subsref at 14
Not enough inputs to inline function.
What I need is f as function in h so i can work with.

Best Answer

Anonymous functions are easier.
F = @(x1, x2) 4*(sqrt(x1^2 + (10-x2)^2 )-10)^2 + 0.5*(sqrt(x1^2 + (10+x2)^2 )-10)^2 -5*(x1+x2); %you do not appear to use F!
g = @(x1, x2, h) 4*(sqrt(x1^3 + (10-(x2+s2*h))^2 )-10)^2 + 0.5*(sqrt((x1+s1*h)^2 + (10+(x2+s2*h))^2 )-10)^2 -5*((x1+s1*h)+(x2+s2*h));
x1 = -4; %are these really constants??

x2 = 5; %are these really constants??
for j = 1 : 200
s1 = -dF1; %is this differential? You cannot differentiate an inline function or an anonymous function
s2 = -dF2; %differentiating what?
f = @(h) g(x1, x2, h);
end