How can I solve a system of equations symbolically?

This is the code that I'm trying to run:
clear;
clc;
syms F1 F2 F3 a m x1 x2 x3 L1 L2 L3;
F = [F1; F2; F3];
x = [x1; x2; x3];
b = [L1; L2; L3];
A = [1 2*m 0; a 3*m 1; 1 1 a];
%Solve F=A*x + b for x (x1, x2, x3)
solve('F1 = x1 + 2*m*x2 + L1', 'F2 = a*x1 +3*m*x2 + x3 + L2', 'F3 = x1 + x2 + a*x3', x1, x2, x3)
I'm trying to get it to solve for x1, x2, and x3 as a function fo the other values. Is there even a way to do this or am I trying to do something that MATLAB doesn't have the ability to do? Please help. Thanks!
Oh, the version of MATLAB I'm using is r2011a.

댓글 수: 1

Dan
Dan 2012년 9월 28일
Ideally, I'd like to just be able to say:
solve('F = A*x + b', x1, x2, x3);
I tried that and it didn't work. Is there anything similar to this that I could use?

댓글을 달려면 로그인하십시오.

 채택된 답변

Andrei Bobrov
Andrei Bobrov 2012년 9월 28일

0 개 추천

syms a m L1 L2 L3;
A = [1 2*m 0; a 3*m 1; 1 1 a];
b = [L1; L2; L3];
x = A\b

댓글 수: 1

Dan
Dan 2012년 9월 28일
This is exactly what I needed! Thank you. I guess I just didn't realize that this would still work. I thought I'd need to use solve for some reason. I did make the following adjustment:
syms F1 F2 F3;
F = [F1; F2; F3;];
B = F - b;
x = A\B
Thanks again!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

태그

질문:

Dan
2012년 9월 28일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by