[問題] 匿名函式跟 ezsurf已回收

看板MATLAB作者 (小康)時間16年前 (2009/03/31 15:18), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
板上的大大們,小弟不才 剛學matlab不久,今天在練習時 用匿名函式碰到的問題 懇請大大們幫忙,感恩~~ ex7_3.m *************************************************** function ex7_3() f=@(x,y) y^2-x^2+1; ezsurf(f,[-3,3,-3,3]);axis tight; xlabel('x-axis');ylabel('y-axis'); *************************************************** 我這樣打之後會出現以下的警告: Warning: Function failed to evaluate on array inputs; vectorizing the function may speed up its evaluation and avoid the need to loop over array elements. > In specgraph\private\ezplotfeval at 59 In ezgraph3>ezeval at 623 In ezgraph3>surfplot at 550 In ezgraph3 at 49 In ezsurf at 65 In ex7_3 at 3 但如果我把變數 f 註解掉,然後把 ezsurf的f改成字串'y^2-x^2+1'後就不會出現了, 2個寫法畫出來的結果都一樣~~ os: windows xp sp3 with Matlab R2007b -- It's not who I am underneath but what I do that defines me. -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.32.68.243
文章代碼(AID): #19qSFUUa (MATLAB)
文章代碼(AID): #19qSFUUa (MATLAB)