I want to ask if it is possible to add these two horizontal matrices and if so, how?

2 Ansichten (letzte 30 Tage)
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]

Antworten (2)

the cyclist
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)
ans = 1×2
5 3
size(S)
ans = 1×2
10 1

Walter Roberson
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

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by