Solve Systems of Linear Equations in MATLAB

帅比萌擦擦* 提交于 2019-12-02 03:27:43

You have 4 equations and 4 unknowns. This is very easily solved in MATLAB using the equation AT = b, where T = A\b.

First move all the constant values over to the RHS. Then, reorder the equations to the form below (but don't write a11 = -3.615 etc in MATLAB, it's just to visualize it so that it's easier to create the A matrix below). If you have more equations and unknowns it might be easiest to do this with pen and paper before you create the matrix in MATLAB, as it's easy to get a sign wrong, or overlook a value somewhere.

a11*T1 + a12*T2 + a13*T3 + a14*T4 
a21*T1 + a22*T2 + a23*T3 + a24*T4
... and so on. 

Create a matrix A with the values a11, a12 ... all the way to a44. Now you can find the T's by using \ like this:

A = [-3.615  1       1    0;
     1      -5.752   0    2;
     1       0      -4    2;
     0       1       1   -4];
b = [0; -10; -38; -83];
T = A\b

T =  
   11.8878
   14.7558
   28.2188
   31.4936
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!