Clear Filters
Clear Filters

Info

This question is closed. Reopen it to edit or answer.

Fault in result in formula

3 views (last 30 days)
Dani D
Dani D on 24 Apr 2016
Closed: MATLAB Answer Bot on 20 Aug 2021
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 Comment
Stefan Raab
Stefan Raab on 24 Apr 2016
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

Answers (0)

This question is closed.

Community Treasure Hunt

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

Start Hunting!