Matrix with unknown values
이전 댓글 표시
Dear community, I am loosing my mind with this simple problem:
A = B .* X
where A and B are two arrays [3x1x80] and X is a matrix [3x3x80].
As X has 5 unknown values I tried to implement this matrix equation with fminsearch:
function [estimates,model] = findvalues(A,B)
X0 = [0.1 0.1 0.2 0.3 0.56];
model = @maps;
options=optimset('Display','off','MaxIter',100000,'MaxFunEvals',100000,'TolX',1e-8);
[estimates] = fminsearch(model, X0, options);
function [ FittedCurve,sse] = maps(params)
X = zeros(3,3,80);
a = params(1);
b = params(2);
c = params(3);
d = params(4);
e = params(5);
X(1,1,:) = -(Rb + (1 ./ a));
X(1,2,:) = (1 ./ b) - (((e - (1 - f)) ./ f) ./ (V ./ f) .* (1 ./ c));
X(2,1,:) = (1 ./ a);
c = -(((r1o .* CRo) + R1o0) + (1 ./ b));
X(2,2,:) = c';
X(2,3,:) = (1 ./ c);
X(3,2,:) = (1 ./ b) - ((d./(V.*(1-h))).*(1./a));
X(3,3,:) = (-(Ri + (1 ./ c)));
for i = 1:80
FittedCurve(:,:,i) = mtimes( ((sin(a) .* (I - ((exp(X(:,:,i))).^TR))) , B);
end
ErrorVector = FittedCurve - A;
sse = sum((ErrorVector .^ 2),3);
end
end
It does not work. Is it because maybe fminsearch is not the most suitable function for this problem? Or is there a conceptual mistake?
I really thank you for the support.
댓글 수: 2
Please fix:
A and X are two arrays [3x1x80] and X is a matrix [3x3x80].
One of the matrices is B.
Please explain "in does not work" with any details. It is easier to suggest a solution than to guess the problem.
Marianna
2018년 2월 7일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!