Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Matlab program for finding the real value of a binary value

Status
Not open for further replies.

v9260019

Member level 2
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
 

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
 

    v9260019

    Points: 2
    Helpful Answer Positive Rating
A matlab question ??

Thanks mimomod
I got it now~~~~~
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top