[討論] 指令問題

看板MATLAB作者 (出來面對)時間14年前 (2011/11/08 11:16), 編輯推噓1(104)
留言5則, 4人參與, 最新討論串1/1
x = 0:0.1:4*pi; subplot(2, 2, 1); plot(x, sin(x)); % 此為左上角圖形 subplot(2, 2, 2); plot(x, cos(x)); % 此為右上角圖形 subplot(2, 2, 3); plot(x, sin(x).*exp(-x/5)); % 此為左下角圖形 subplot(2, 2, 4); plot(x, x.^2); 請問一下 位什麼sin(x). 和 x. 右下角藥有一個點 沒點跑不出圖@@ 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.113.150.41

11/08 11:33, , 1F
是 .* 跟 .^2
11/08 11:33, 1F

11/08 12:53, , 2F
element by element array operation
11/08 12:53, 2F

11/08 14:17, , 3F
你的x是1x126的向量,只能和126x1的矩陣相乘
11/08 14:17, 3F

11/08 14:18, , 4F
多加上一個.表示這非矩陣運算,而是對應位置元素的運算
11/08 14:18, 4F

11/08 16:52, , 5F
pointwise Multiplication
11/08 16:52, 5F
文章代碼(AID): #1Ek9ydv8 (MATLAB)