convert codes into matlab R2015b
1 次查看(过去 30 天)
显示 更早的评论
close all; clear; clc;
%menentukan opsi optimisasi
options = optimoptions(@fminunc,'Display','iter','Algorithm','quasi-newton');
%menentukan guess value
xy_guess = [0,0];
%memanggil algoritma optimisasi
[xy_opt, fval] = fminunc(@rosenbrock_func,xy_guess,options)
%fungsi objektif
function f = rosenbrock_func(in);
x = in(1);
y = in(2);
f = 100*(y-x^2)^2 + (1-x))^2
end
how can i convert this code into matlab R2015b?
3 个评论
dpb
2020-3-22
What does "it doesn't work" mean, precisely? Show us...
Your code above includes the definition of rosenbrock_func. You must place that code in its m-file of that name in a location on your matlabpath; functions are not defined in the command wlndow inline.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Function Creation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!