So lets say I have 2 matrices A and B. I need to solve 2 eqns involving specific elements of each matrix.(adsbygoogle = window.adsbygoogle || []).push({});

e.g. A(1)+B(2)=4; A(1)-B(2)=2.

Is there any way to do this? My efforts with Fsolve and solve have failed.

Here's what I've done so far:

function F=myfun(A,B)

F=[A(1)-B(2)-2;

A(1)+B(2)-4];

end

In the command window I typed:

>>A=ones(2,2);

>> B=ones(2,2);

>> [A,B]=fsolve(@myfun,A,B)

I even tried

[A(1),B(1)]=fsolve(@myfun,A(1),B(1))

Neither attempt worked.

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Solving equations involving specific elements of matrices in MATLAB?

Tags:

**Physics Forums | Science Articles, Homework Help, Discussion**