Solving for two uknown vectors in a matrix equation
2 views (last 30 days)
Show older comments
So I have a matrix A (which is given) and its nullspace is 5x3 and its row space is 5x2,
so the basis of the nullspace and the basis of the row space will form a basis for R^5 and I want to calculate the values for two vectors such that these two basises form a vector that I have.
I.e I want to solve
Where N is the vectors that form a base for my nullspace and R is the vectors that form a base for my rowspace, and are my uknowns and
so to calculate this in matlab I tried the following:
A = [...] %too lazy to type it out as it's quite big
N = null(sym(A)); %5x2 matrix
R = colspace(sym(A')); %5x3 matrix
x = [1 2 3 4 5]';
syms t s %my unknowns
[t, s] = solve(N*t+R*s == x, t, s)
but whatever I do, I either get that my array sizes doesn't match. Which doesn't make sense to me because the dimensions of t should be 2x1 and the dimensions of s should be 3x1, or it tells me something about that my vectors aren't symbolic which makes even less sense.
I don't specify the dimensions anywhere for t and s which I guess could be a problem, but I didn't find a way of doing this unless I also filled them with elements which is not what I want to do.
Anyways, I'd really appreciate any help I can get.
Thanks in advance!
0 Comments
Answers (1)
Torsten
on 2 Apr 2019
syms t1 t2 s1 s2 s3
[solt1 solt2 sols1 sols2 sols3] = solve([N*[t1;t2]+R*[s1;s2;s3] == x],[t1 t2 s1 s2 s3])
0 Comments
See Also
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!