Solving systems of non-linear equations with two unknown coefficients a and b (scalars or vectors solutions ?)

Viewed 336

I have systems of non-linear equations and I am looking for getting the two unknown "a" and "b" of the problem ( for the moment, I don't know if "a" and "b" could be only vectors or matrix solutions or maybe only scalars).

The difficulty is that my equation is under matrix form (I mean that I have simply in theory only scalars "a" and "b" that multiplies matrices).

I would like to use Matlab to solve this system of two non-linear equations (a and b are the unknown).

Here is the two independent equations : caution ! : "FISH_sp", "FISH_xc", "eigenv_sp" and "eigenv_xc" are known matrices.

eigen_sp, eigen_xc and FISH_eigen_sum are also scalar knonw.

I have coded the following system of 2 non-linear equations implemented in the following function (with a and b to find) :

myfun=@(a,b) [
% First equation
a^2*eye(7) + a*b*FISH_sp*FISH_xc'+a*b*FISH_xc*FISH_sp'+b^2*eye(7);
% Second equation
a*FISH_sp*eigenv_sp + b*FISH_eigen_sp*eigenv_xc + a*FISH_xc*eigenv_sp +...
b*FISH_xc*eigenv_xc - (eigenv_sp + eigenv_xc)*FISH_eigenv_sum];

% Solution of system of non linear equations
a0 = 0.5;
b0 = 0.5;
x0 = [ a0 b0 ];
y = fsolve(@(x)myfun(x(1),x(2)), x0)

But this gives me the following error :

Error using vertcat
Dimensions of matrices being concatenated are not consistent.

Error in
compute_solving_Matricial_Equations>@(a,b)[a^2*eye(7)+a*b*FISH_sp*FISH_xc'+a*b*FISH_xc*FISH_sp'+b^2*eye(7);a*FISH_sp*eigenv_sp+b*FISH_eigen_sp*eigenv_xc+a*FISH_xc*eigenv_sp,+b*FISH_xc*eigenv_xc-(eigenv_sp+eigenv_xc)*FISH_eigenv_sum]

Error in compute_solving_Matricial_Equations>@(x)myfun(x(1),x(2))

Error in fsolve (line 230)
            fuser = feval(funfcn{3},x,varargin{:});

Error in compute_solving_Matricial_Equations (line 55)
y = fsolve(@(x)myfun(x(1),x(2)), x0)

Caused by:
    Failure in initial objective function evaluation. FSOLVE cannot continue.

Anyone could see what's wrong to solve this system of 2 non linear functions described in the function myfun ?

0 Answers
Related