# Problem with matrix calculation

2 views (last 30 days)
Thomas Koelen on 7 Apr 2015
Edited: Matt J on 7 Apr 2015
I have the following line of code that represents the inverse function of:
a+b*(100*10^-x)^c
this is the x:
x=double(gssq.(strcat(sheetNamesOECF{rgby2d},num2str(rgby2d2)))(:,:,1))/255
0.1098 0.1137 0.1137 0.1137 0.1137 0.1137 0.1098 0.1098 0.1137
0.1098 0.1176 0.1137 0.1098 0.1098 0.1098 0.1098 0.1098 0.1098
0.1137 0.1176 0.1137 0.1098 0.1137 0.1137 0.1176 0.1137 0.1137
0.1098 0.1137 0.1098 0.1098 0.1098 0.1098 0.1137 0.1098 0.1098
0.1137 0.1098 0.1059 0.1098 0.1137 0.1098 0.1098 0.1098 0.1098
this is the inverse function:
-log10(((coeffr(1,1)-double(x)/100^coeffr(1,3)/coeffr(1,2))^(1/coeffr(1,3))))
now, when I fill it in like this:
-log10(((coeffr(1,1)-double(0.1)/100^coeffr(1,3)/coeffr(1,2))^(1/coeffr(1,3))))
I get:
2.2059 + 0.7575i
but when I fill in the matrix instead of the constant I get values like this:
1.1654 + 0.7560i
these are way smaller than what they are supposed to be.
does anyone know why filling in the same value gives me different results?
Kind regards,
Thomas Koelen
##### 2 CommentsShowHide 1 older comment
Thomas Koelen on 7 Apr 2015
1. I don't understand why double x would be 9*0.11, could you explain yourself further?
2. This is my mistake, I just replaced the 0.1 with x here, in the code it's actually x.
3. Because I didn't know this function earlier on and already created a structute that has all the seperate channels.
4. because it is a normalised pixel value to calculate the OECF curve, so the pixels go from 0-1.
Kind regards

Matt J on 7 Apr 2015
Edited: Matt J on 7 Apr 2015
Are you sure the cube root of -1 is also -1? This command thinks so
>> nthroot(-1,3)
ans =
-1
but this command has a different opinion,
>> (-1)^(1/3)
ans =
0.5000 + 0.8660i

### Categories

Find more on Logical in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!