何必手算?MATLAB求解線性方程組(以回路電流法為例)|Matlab符號(hào)計(jì)算


clc
clear
close all
syms R1 R2 R3 R4 R5 R6 Us1 Us5
syms I11 I12 I13
[R1, R2, R3, R4, R5, R6, Us1, Us5] = deal(1, 1, 1, 2, 2, 2, 4, 2);
equ = [R1*I11+Us1+R6*(I11-I13)+R5*(I11+I12-I13)-Us5+R4*(I11+I12)==0;...
??R2*I12+R5*(I12+I11-I13)-Us5+R4*(I11+I12)==0;...
??R6*(I13-I11)+R3*I13+Us5+R5*(I13-I11-I12)==0]
f = solve(equ, [I11, I12, I13]);
I11 = double(f.I11)
I12 = double(f.I12)
I13 = double(f.I13)
A = [7 4 -4;4 5 -2;-4 -2 5];
B = [-2; 2; -2];
g = A\B
標(biāo)簽: