[問題] function數值輸出問題已回收

看板MATLAB作者 (C豪)時間14年前 (2011/05/17 22:50), 編輯推噓0(002)
留言2則, 2人參與, 最新討論串1/1
我寫一個function function [output] = xsq(input) output = input.^2 end x=1:10; y=xsq(x) 在這裡y會輸出10個不同的值 可是如果function變成 function [output] = xsq(input) output = (sin(input))/(1+input.^2) end x=1:10; y=xsq(x) 最後y會變"只有一個值" 這是為什麼呢? 感謝各位! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.122.204.62

05/17 22:54, , 1F
output = (sin(input))./(1+input.^2)
05/17 22:54, 1F

05/17 22:56, , 2F
感謝樓上!!! 突然之間頓悟了
05/17 22:56, 2F
文章代碼(AID): #1DqeiVOn (MATLAB)