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

3 views (last 30 days)
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

Answers (2)

Walter Roberson
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))
  1 Comment
Alina Abdikadyr
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

Sign in to comment.


Torsten
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
  3 Comments

Sign in to comment.

Categories

Find more on Linear Algebra in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by