Splitting a matrix into addition of two same size Matrices
1 view (last 30 days)
Show older comments
A 12*12 Matrix P is given to us,this matrix has each of it's element as a quadratic expression in symolic variable x3.This Matrix P needs to be made into an addition of 3 different 12*12 matrices A,B,C such that P=A*x3^2+B*x3+C
How can we find these matrices A,B,C in matlab ?
0 Comments
Answers (2)
Walter Roberson
on 30 Jul 2020
parts_cell = arrayfun(@(s) coeffs(s,x3,'all'), P, 'uniform', 0);
parts_matrices = num2cell(vertcat(parts_cell{:}),1);
A = reshape(parts_matrices{1}, size(P));
B = reshape(parts_matrices{2}, size(P));
C = reshape(parts_matrices{3}, size(P));
0 Comments
See Also
Categories
Find more on Matrix Indexing 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!