Info
この質問は閉じられています。 編集または回答するには再度開いてください。
How do I fix this?
1 回表示 (過去 30 日間)
古いコメントを表示
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
0 件のコメント
回答 (1 件)
Alan Weiss
2019 年 2 月 1 日
You probably need to write
min = fminsearch(@calc, in0); % Note the @ symbol
Alan Weiss
MATLAB mathematical toolbox documentation
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!