Problem with matrix calculation
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
Joep
2015-4-7
double(x) and double(0.11) are not equal. double(x) is in this cames almost 9*0.11. That's why the number is 2 times as high.
The second why use a second double(x)? the numbers are already double. If you want to use the first number of x. Use x(1) or x(1,1).
The third why you using double(...)/255 you can use instead of these im2double, does exact the same but the deference is this function already devides it by 255.
The forth point is are you sure you not reflecting the RGB coefficients with these coefficients? otherwise you should multiply this coefficients by 255.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!