Info

此问题已关闭。 请重新打开它进行编辑或回答。

Fault in result in formula

1 次查看(过去 30 天)
Dani D
Dani D 2016-4-24
关闭: MATLAB Answer Bot 2021-8-20
Hello, I want implement this formula . but i think it give me fault result. For example : X = 156 and Pmn should be .0540 but with matlab give me .0059
input = imread('cameraman.tif');
[m , n] = size(input);
output = zeros(m,n);
L = 256;
Xmax = L - 1 ;
Fe = 2;
Fd = 30;
Pmn = zeros(m,n);
Pmn = double(Pmn);
for i = 1:m
for j = 1:n
Xmn = double(input(i,j));
Pmn(i,j)=1/((1+((Xmax-Xmn)/Fd)).^Fe);
end
end
  1 个评论
Stefan Raab
Stefan Raab 2016-4-24
Hello,
I cannot reproduce your error. If I set m=1, n=1 and input=156, then MATLAB calculates the correct result Pmn = P11 = 0.0540832.... Here my code, I changed only the input:
n = 1;
m = 1;
input = 156;
output = zeros(m,n);
L = 256;
Xmax = L - 1 ;
Fe = 2;
Fd = 30;
Pmn = zeros(m,n);
Pmn = double(Pmn);
for i = 1:m
for j = 1:n
Xmn = double(input(i,j));
Pmn(i,j)=1/((1+((Xmax-Xmn)/Fd)).^Fe);
end
end

回答(0 个)

此问题已关闭。

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by