# Extract values from one matrix and with iteration solve the system of linear equations

2 views (last 30 days)
Alina Abdikadyr on 3 Oct 2022
Commented: Alina Abdikadyr on 4 Oct 2022
Hello everyone!
Please, help me write a code for solving the system of linear equations in Matlab
If I have a column of coefficients A [A1;A2;A3] and the inverse matrix 3x3 B^(-1) and unknown column C [C1, C1, C1] (here all values are equal)
I have to find C1 value and plot the graph. Also A1 values can be extraacted from another matrix, so unknowns are A2, A3 and C1
A.'*B^(-1) = C
##### 2 CommentsShowHide 1 older comment
Alina Abdikadyr on 4 Oct 2022
yes

Walter Roberson on 3 Oct 2022
A = randi([-5 5], 5 ,3)
A = 5×3
0 -4 -5 5 3 -4 -1 -1 0 4 3 -5 5 4 -4
B = randi(9,3, 3)
B = 3×3
4 8 7 1 1 9 9 6 1
C = A/B
C = 5×3
-0.7494 -0.0098 0.3342 -0.0319 -0.4889 0.6241 -0.0663 0.0614 -0.0885 0.1057 -0.6904 0.4742 0.1646 -0.6339 0.5528
plot(C(:,1)) Alina Abdikadyr on 3 Oct 2022
Thank you for your answer! but A2 and A3 coefficients for me are unknown. So (A1, A2, A3)*B matrix = (C1,C1,C1). I should find A2, A3 and C1

Torsten on 4 Oct 2022
Edited: Torsten on 4 Oct 2022
B = rand(3,3);
A1 = 4;
rhs = -A1*B(1,:).';
Mat = [-ones(3,1),B(2:3,:).'];
sol = Mat\rhs;
C1 = sol(1)
C1 = 9.4544
A2 = sol(2)
A2 = 80.7027
A3 = sol(3)
A3 = -250.8747
[A1 A2 A3]*B-[C1 C1 C1]
ans = 1×3
1.0e-14 * -0.3553 -0.3553 -0.7105
Alina Abdikadyr on 4 Oct 2022
Thank you!!!!!

### Categories

Find more on Linear Algebra in Help Center and File Exchange

R2022b

### Community Treasure Hunt

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

Start Hunting!