How do I fix this?
Info
This question is closed. Reopen it to edit or answer.
Show older comments
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
Answers (1)
Alan Weiss
on 1 Feb 2019
0 votes
You probably need to write
min = fminsearch(@calc, in0); % Note the @ symbol
Alan Weiss
MATLAB mathematical toolbox documentation
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!