Dear all,
I would like to minimize a function called "cal4" (please see below) that is function of a matrix H. I would like to do the minimization by changing the matrix H ( 7 by 7). When I write the code:
%%%%%%%%%%%%%%%%%%%%%%%%%
start0=eye(7);
g= fminsearch(@(H)cal4(H), start0);
I get the following error message:
??? Subscripted assignment dimension mismatch.
Error in ==> fminsearch at 205
fv(:,1) = funfcn(x,varargin{:});
Error in ==> cal5 at 106
g= fminsearch(@(H)cal4(H), start0);
Any ideas where the problem is? I dont understand why there is a dimension mismatch because the output of "cal4" is also 7 by 7 matrix. Sorry I can not copy cal4 because the function is quite long but I am happy to clarify further if necessary.
Now I also would like to minimize "cal4" by only changing some elements of the matrix (not the whole matrix because I would like to the diagonals to be equal to 1 all the time) .
How I can do that using fminsearch? I tried something like
g= fminsearch(@(H(2,1))cal4(H), 0.1) but matlab does not accept that.....
Any help or suggestion is welcomed. Thank you very much
Best Regards
S
