[問題] 有沒有人幫看一下這程式有沒有寫錯已回收

看板MATLAB作者 (chen)時間17年前 (2008/12/04 15:33), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/2 (看更多)
題目:Calculate the log and square of each pixel in the    image of mandrill 我寫了一個function m-file 用for loop來寫 function [y1,y2]=forloop(X) tic [m,n]=size(X) for i=1:m y1=image(log(X)); end figure for i=1:m y2=image(X.^2); end toc 我先load mandrill.mat 然後run三次 function m-file 結果三次都不太一樣 (1) Elapsed time is 24.779000 seconds. y1 = 151.1481 y2 = 306.1475 (2) Elapsed time is 22.314000 seconds. y1 = 156.1476 y2 = 309.1475 (3) Elapsed time is 25.278000 seconds. y1 = 5.1477 y2 = 309.2939 有沒有大大能幫我看看是程式有誤 或是甚麼原因造成這樣的結果 感謝!! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 163.25.118.76
文章代碼(AID): #19DuVF75 (MATLAB)
文章代碼(AID): #19DuVF75 (MATLAB)