How to plot 2 D powell function with the code given below?
3 次查看(过去 30 天)
显示 更早的评论
% code
function y = powell(x)
%
% Powell function
% Matlab Code by A. Hedar (Nov. 23, 2005).
% The number of variables n should be adjusted below.
% The default value of n = 24.
%
n = 24;
m = n;
for i = 1:m/4
fvec(4*i-3) = x(4*i-3)+10*(x(4*i-2));
fvec(4*i-2) = sqrt(5)*(x(4*i-1)-x(4*i));
fvec(4*i-1) = (x(4*i-2)-2*(x(4*i-1)))^2;
fvec(4*i) = sqrt(10)*(x(4*i-3)-x(4*i))^2;
end;
fvec = fvec';
y = norm(fvec)^2;
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!