[問題] 有沒有人幫看一下這程式有沒有寫錯已回收
題目: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
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):
MATLAB 近期熱門文章
PTT數位生活區 即時熱門文章