h = double(subs(hf,{x,y},{x(1),x(2)})); if det(h)>0 && h(1,1)>0 in matlab

The double() function casts its argument to double precision. The subs() function is used for substitution where hf is a symbolic expression or function of two variables x and y, {x(1), x(2)} is a vector of values to substitute for x and y. After substituting these values, h stores the double precision values of hf for the given input.

The && operator checks if the two conditions are true, i.e., det(h) > 0 and h(1,1) > 0. If both the conditions are true, then the statement is executed.

Here's the combined code:

main.m
h = double(subs(hf,{x,y},{x(1),x(2)}));
if det(h)>0 && h(1,1)>0
    % code to execute here
end
95 chars
5 lines

Note: hf, x, and y should be defined beforehand, and the code inside the if statement should be replaced with the relevant code to be executed.

gistlibby LogSnag