Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8219271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:05:48+00:00 2026-06-07T13:05:48+00:00

I was provided with this code m0=0.8; m1=1.2; k=6; %where k can take values

  • 0

I was provided with this code

m0=0.8;
m1=1.2;
k=6; %where k can take values between 2 and 10;
kbar=2^k;
g_m = [0:(kbar-1)];

for i = 1: (kbar)
  g=1;
  for j=0:(kbar-1)
    if(bitand(g_m(i),2^j))~=0
      g=g*m1;
    else
      g=g*m0;
    end
  end
  g_m(i)=g %results in a 1xN vector where N = all the possible states
end

My question is why the function of bitand allows you to generate all the possible “states”?
I am not too sure if I really understand the logic behind bitand beside searching if the values that it compares have a bit = 1, hence ans=1.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T13:05:50+00:00Added an answer on June 7, 2026 at 1:05 pm

    bitand takes 2 values, converts them into binary, makes logical AND between the two values and returns the result form the logical AND as a decimal number. so for 2 given numbers, it returns only one value

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code in Linq. Anybody can provide the t-sql. thanks! var tsr
I'm new to this kabeja package so please can some one provide code example
Trying to understand the math of this code snippet. A token is provided which
I'm working with some code provided via this post , courtesy of @Phrogz. I've
So, I took some code from this Microsoft provided Example which allows me to
This is the code snippet that the developer site has provided for getting a
From this site: http://www.toymaker.info/Games/html/vertex_shaders.html We have the following code snippet: // transformations provided by
my code is like this int dateColumn = c.getColumnIndex(android.provider.CallLog.Calls.DATE); long callDate = c.getInt(dateColumn); SimpleDateFormat
I am able to provide animation to an image button from below code. this.RegisterName(image1.Name,
I've been trying every tip provided on this site, but none worked, so I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.