Define a function_handle with array of variable dimension as an input

Hi everybody,
I've a probleme of unconstrained optimization and I would like to define the following function as a function_handle such that dimension is variable, for example:
where I wonder if it's possible or there is a another way to define F.
Thank You in advance for Your Help

댓글 수: 2

Doesn't look very difficult to do with a loop. What have you tried to do?
Yes I did, it works. But I used code suugested in first answer.

댓글을 달려면 로그인하십시오.

답변 (1개)

F = @(x) sum((10*(x(1:2:end) - x(2:2:end)) + (x(1:2:end)-1)).^2)

카테고리

도움말 센터File Exchange에서 Surrogate Optimization에 대해 자세히 알아보기

제품

릴리스

R2022b

질문:

2023년 1월 10일

댓글:

2023년 1월 11일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by