How do I fix this?

clear;
clc;
in0 = [1 1 1 1 1 1 1 1 1 0.01];
min = fminsearch(calc, in0);
function y = calc(in)
map(1:101,1:101) = 1;
for row = 1:101
for column = 1:101
map(row, column) = in(1)*exp(-((row-in(4))^2/(2*(in(10))^2)+(column-in(7))^2/(2*in(10))^2))) + %the same thing as before but with in(1) in(4) in(7) replaced by in(2) in(3) in(5) in(6) in(8) in(9)
end
end
z = xlsread('C:\etc\D01', 'C3:CY103'); %101x101 array
y = sum((map-z).^2, 'all');
end
The error says "Not enough input arguments" at the
map(row, column)
line. I've tried removing the fminsearch, and the function returns a perfectly good output, but with the optimization it does not work. Help is really really appreciated. Thanks
Toolboxes used: Optimization

回答 (1 件)

Alan Weiss
Alan Weiss 2019 年 2 月 1 日

0 投票

You probably need to write
min = fminsearch(@calc, in0); % Note the @ symbol
Alan Weiss
MATLAB mathematical toolbox documentation

この質問は閉じられています。

製品

リリース

R2018b

質問済み:

Y A
2019 年 2 月 1 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by