angelov

0 Reputation

0 Badges

15 years, 157 days

MaplePrimes Activity


These are answers submitted by angelov

I am not quite sure. what exactly you need.. OK, I assume you have same measurements of colors and for each color you have something like RGB color code. And I assume that you need a function which will mat the temperature to color code and the other way around. If the assumptions are correct, I would do it in the following way: 1. Normalize the color codes between 0 and 255 dec (or 0xFF hex) for each color - R, G and B. 2. By this you will obtain a table something like: R G B temperature Now you need to convert the color code triple to one number by: color_code=r*65536+G*256+B 3. Plot color_code against the temperature. Does it look now like a nice function? Polynomial, exponent, linear? Construct one and try to minimize it with some least squares: there are a lots of examples in matlab about that. 4. When you do that, you can convert temperature to color_code and then you have to convert color_code to RGB values again. There are dec2hex() and hex2dec() functions in Matlab. Good Luck! :)
I also had such a problem. And as I could not find how to make maple declare the new variables, I wrote a small bash script. Here it is: #!/bin/bash echo -n "double " for a in `seq $1` do if [ $a -lt $1 ] then echo -n "t$a, " else echo -n "t$a;" fi done echo "" To use it: copy the code and save it in a file var_def.sh. Then make it executable: chmod 700 var_def.sh Then call it as: var_def.sh 6000 > dec_t.txt if you need declaration for variables up to t6000. Your declaration will be saved in the file dec_t.txt. Good luck!
Page 1 of 1