% cq4d.m -- Convex quartic in 4 variables, gradient, for M604 HW04
%
% Global variable CQ4_SIGMA is used
%

% (c) Philip D. Loewen
% 23 Feb 2001 -- Original
%  7 Mar 2001 -- Corrected (!)

function gradf = cq4d(x)

global CQ4_SIGMA

s = CQ4_SIGMA;
A = [5,1,0,0.5; 1,4,0.5,0; 0,0.4,3,0; 0.5,0,0,2];

x = x(:);

gradf = x' + s*(x'*A*x)*x'*A;
