I want to ask if it is possible to add these two horizontal matrices and if so, how?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
T = [1 3 6; 6 5 8; 7 8 -2; 8 -9 8; 3 -1 -7]
S = [6;8;-2;8;-7;4;9;-8;3;-2]
0 Kommentare
Antworten (2)
the cyclist
am 25 Nov. 2022
As shown below, these two arrays have different sizes, and not even the same number of elements. Tt is very unclear, mathematically, what it means to "add" them.
Can you tell us what you mean? What do you expect the result to be?
T = [1 3 6; 6 5 8; 7 8 -2; 8 -9 8; 3 -1 -7];
S = [6;8;-2;8;-7;4;9;-8;3;-2];
size(T)
size(S)
0 Kommentare
Walter Roberson
am 25 Nov. 2022
No, it is not possible. The first one is 5 x 3 and the second is 10 x 1.
You can extract the first 5 rows of S and add that to T, giving a 5 x 3 result.
You can imresize(T) to have 10 rows, same as S
You can repmat(T,2,1) or repelem(T,2,1) to have 10 rows, same as S
You can
ifft(fft(T), size(S,1)) + S
0 Kommentare
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!