Mar 27, 2006 #1 V v9260019 Member level 2 Joined Jun 5, 2005 Messages 47 Helped 0 Reputation 0 Reaction score 0 Trophy points 1,286 Activity points 1,680 Hello everyone If I want to find the real value of the binary value [1 0 1 0 1 0 1 0] for the range 0~20, and I defind the program as follows: "function real = GA (bit,range); deci=polyval(bit,2); real=deci/(2^length(bit)-1)*(range(2)-range(1))+range(1);" When I run it ~~~ it seems has some errors: "??? Input argument "bit" is undefined. Error in ==> GA at 2 deci=polyval(bit,2);" What is the problem ???? thanks a lot
Hello everyone If I want to find the real value of the binary value [1 0 1 0 1 0 1 0] for the range 0~20, and I defind the program as follows: "function real = GA (bit,range); deci=polyval(bit,2); real=deci/(2^length(bit)-1)*(range(2)-range(1))+range(1);" When I run it ~~~ it seems has some errors: "??? Input argument "bit" is undefined. Error in ==> GA at 2 deci=polyval(bit,2);" What is the problem ???? thanks a lot
Mar 27, 2006 #2 M mimomod Member level 4 Joined Jan 25, 2006 Messages 77 Helped 22 Reputation 44 Reaction score 7 Trophy points 1,288 Activity points 2,351 A matlab question ?? Hi v9260019, how did you run the function? You must define the "bit" value in the argument of the function. So you must run it: GA([1 0 1 0 10 1 0],[0, 20]); (I assume the conversion you wrote is correct) best
A matlab question ?? Hi v9260019, how did you run the function? You must define the "bit" value in the argument of the function. So you must run it: GA([1 0 1 0 10 1 0],[0, 20]); (I assume the conversion you wrote is correct) best
Mar 27, 2006 #3 V v9260019 Member level 2 Joined Jun 5, 2005 Messages 47 Helped 0 Reputation 0 Reaction score 0 Trophy points 1,286 Activity points 1,680 A matlab question ?? Thanks mimomod I got it now~~~~~