Untitled
unknown
plain_text
2 years ago
435 B
5
Indexable
function z=Sphere(x, y, d)
switch y
case 1
z=sum(x.^2);
case 2
z=sum(abs(x))+prod(abs(x));
case 3
z=0;
for i=1:d
z=z+sum(x(1:i))^2;
end
case 4
z=max(abs(x));
case 5
z=sum(100*(x(2:d)-(x(1:d-1).^2)).^2+(x(1:d-1)-1).^2);
endEditor is loading...
Leave a Comment