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] >>(right shift) and <<(left shift)

Status
Not open for further replies.

davyzhu

Advanced Member level 1
Joined
May 23, 2004
Messages
494
Helped
5
Reputation
10
Reaction score
2
Trophy points
1,298
Location
oriental
Activity points
4,436
matlab shift

Hi all,

How >>(right shift) and <<(left shift) 2'complement number
(both positive and negative integer).

Is x>>2 equal to floor(x/4)?

And is x<<2 equal to x*4?

Best regards,
Davy
 

davyzhu

Advanced Member level 1
Joined
May 23, 2004
Messages
494
Helped
5
Reputation
10
Reaction score
2
Trophy points
1,298
Location
oriental
Activity points
4,436
matlab left shift

Hi hr_rezaee,

Thanks!

The bitshift C = bitshift(A, k) returns the value of A shifted by k bits. Input argument A must be an unsigned integer or an array of unsigned integers.

But I need the signed version.

I used to use floor(x/(2^n)) to emulate x>>n, is it right?

Best regards,
Davy
 

davyzhu

Advanced Member level 1
Joined
May 23, 2004
Messages
494
Helped
5
Reputation
10
Reaction score
2
Trophy points
1,298
Location
oriental
Activity points
4,436
matlab shift left

Hi,

I copy the x >> y definition from a video standard (H.264).

Arithmetic right shift of a two's complement integer representation of x by y binary digits. This function is defined only for positive integer values of y. Bits shifted into the MSBs as a result of the right shift have a value equal to the MSB of x prior to the shift
operation.

Did matlab provide a arithmetic shift function?

Best regards,
Davy
 

hr_rezaee

Advanced Member level 3
Joined
Oct 6, 2004
Messages
751
Helped
109
Reputation
218
Reaction score
24
Trophy points
1,298
Location
Iran-Mashhad
Activity points
4,029
matlab bit shift

Hi
I don't know but study "Simulink Reference>Shift Arithmetic" and "Simulink Fixed Point>shifts".
they can help you.
regards
 

farhantariq

Member level 3
Joined
Jun 13, 2006
Messages
58
Helped
6
Reputation
12
Reaction score
4
Trophy points
1,288
Location
Pakistan
Activity points
1,600
matlab shift function

why dont u check MATLAB help for exact answer.u will find brief explanation there
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top