我有兩個問題。 我該如何去乘以不同維度的數組?乘以不同尺寸的陣列
Question 1 Example:
A1=1,2,3,4,5,6
A2=1,2,3
The answer I would like to get would be
A1*A2 =1,4,9,4,10,18
我在想使用repmat,但這是最好的方法嗎?
而且
Question 2 Example:
A1=1,2,3,4,5,6,7 (notice the addition of another value the number 7)
A2=1,2,3
The answer I would like to get would be
A1*A2 =1,4,9,4,10,18,7 (notice the addition of another value the number 7)
我想for循環,但陣列是非常大的500,000+值和需要很長的時間才能完成。
有沒有辦法編寫一些適用於這兩個問題/示例的matlab /代碼?
1,4,9 ...?我不知道你是如何得到1,4,6 ... –
你在做元素乘法('A1。* A2')嗎?您的代碼表示矩陣乘法('A1 * A2')... – kkuilla
@Mad物理學家感謝您的接觸我將6更改爲9並更新了問題 –