solve system by converting a matrix to vector

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

Réponses (1)

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

Catégories

En savoir plus sur Mathematics dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by