fmincon is not working
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I Have defined a function (see below) and it works fine - I can calculate the value of the function for any parameter values (refprice and r). However, when I try and run fminunc it gives an error message relating to the function
fun=@(refprice,r)sum((prices-refprice*ot+(exp(-r*t).*ot')').^2);
ERROR MESSAGE
Error using *
Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of
rows in the second matrix. To operate on each element of the matrix individually, use TIMES (.*) for elementwise
multiplication.
Error in analysedata>@(refprice,r)sum((prices-refprice*ot+(exp(-r*t).*ot')').^2) (line 13)
fun=@(refprice,r)sum((prices-refprice*ot+(exp(-r*t).*ot')').^2);
Error in fminunc (line 307)
f = feval(funfcn{3},x,varargin{:});
Error in analysedata (line 17)
[ests,ss]=fminunc(fun,pars0);
0 comentarios
Ver también
Categorías
Más información sobre Solver Outputs and Iterative Display en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!