solve system by converting a matrix to vector

1 visualización (últimos 30 días)
Hajar Alshaikh
Hajar Alshaikh el 16 de Feb. de 2023
Respondida: Torsten el 16 de Feb. de 2023
how i can solve like this eqation:
Ax=b for x,
where A is 2(n-1)×2(n-1) matrix
and b is 2(n-1)×(n-1)matrix
and x=[u v]' is 2(n-1)×(n-1)matrix where u and v are (n-1)×(n-1) matrices
i tried to ues lsqr but i always got an error. I think that because b should be a vector andon also x should be one variable not two u and v.
so my qusetion is can i convert x and b to be as vector and how?
and if i can convert them then i have to change the size of A and make it larger than what its , i think about adding zeros, but it not works with me

Respuestas (1)

Torsten
Torsten el 16 de Feb. de 2023
n = 4;
A = rand(2*(n-1),2*(n-1));
b = rand(2*(n-1),n-1);
x = A\b
x = 6×3
-0.2838 -5.2253 -6.4847 0.3891 3.3280 -7.6502 0.6037 3.2668 5.9517 -2.3993 -9.4441 3.3258 1.5573 4.1153 -0.2843 1.3017 3.6396 0.9060
u = x(1:n-1,:)
u = 3×3
-0.2838 -5.2253 -6.4847 0.3891 3.3280 -7.6502 0.6037 3.2668 5.9517
v = x(n:2*(n-1),:)
v = 3×3
-2.3993 -9.4441 3.3258 1.5573 4.1153 -0.2843 1.3017 3.6396 0.9060

Categorías

Más información sobre Linear Algebra en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by