How to solve these type of equation using matlab ?
1 次查看(过去 30 天)
显示 更早的评论
x*A+C*x*B=D where "x" is unknown vector of size(3*1) And A is of size(1*3) C is a matrix (3*3) B is again a vector of size (1*3) D is a matrix (3*3)
I used fsolve and lsqnonlin to solve this but unable to solve
A=[1 2 3] B=[4 5 6] C=[4 6 7 ; 8 3 4; 5 2 1] D=[4 2 1 ; 1 3 8; 5 2 1]
When i used fsolve
*Warning: Trust-region-dogleg algorithm of FSOLVE cannot handle non-square systems; using Levenberg-Marquardt algorithm instead. > In fsolve at 324
No solution found.
fsolve stopped because the problem appears regular as measured by the gradient, but the vector of function values is not near zero as measured by the default value of the function tolerance.
x =
0.1013
0.0709
-0.0630*
when i used lsqnonlin
*Local minimum found.
Optimization completed because the size of the gradient is less than the default value of the function tolerance.
x =
0.1013
0.0709
-0.0630*
But answer "x" is not satisfying the original equation. Please help me ! Thanks in advance.
0 个评论
回答(1 个)
Alan Weiss
2014-9-8
In general I don't think that you can solve this kind of problem, because you have just 3 unknowns but you have 9 equations (one for each entry in D). So you would have to be lucky to be given a problem that is solvable.
I have not checked whether this particular problem is solvable, so you might be lucky. If you write out your 9 equations, you can try using backslash (also called mldivide) to solve them directly.
Alan Weiss
MATLAB mathematical toolbox documentation
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!