Good morning please help me :( badly needed
2 次查看(过去 30 天)
显示 更早的评论
How can I equate two matrices element by element suppose the other matrix is a variable matrix?
Ex:
A= [ 1,2,3;2,5,6]
B= [ a+b,a^2+b,c+a;a^2,b,c]
Then the output should Evaluate the valuez of a,b and c
I am typing A=B but that doesnt work also if I type
Y=[A==B], the output will just become
"a+b ==1"
and so on
But does not solve the values what should I do.
Thank you
0 个评论
回答(2 个)
Torsten
2017-12-14
Symbolically, this is not possible since you have 6 equations in 3 unknowns.
Try the numeric way to get the least-squares solution for overdetermined problems:
x0=[1 2 3];
fun=@(x)[x(1)+x(2)-1,x(1)^2+x(2)-2,x(3)+x(1)-3,x(1)^2-2,x(2)-5,x(3)-6];
xsol=lsqnonlin(fun,x0)
Best wishes
Torsten.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!