1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Genrish500 [490]
3 years ago
13

Write a function that iteratively appends random 1's and 0's to an array to form a binary number. The function returns the binar

y result when it's decimal equivalent is larger than the input number. [outArray] = potd11(inputNumber)
Computers and Technology
1 answer:
Anestetic [448]3 years ago
7 0

Answer:

function [result] = potd11(userInput)

result = [0];

d = 0;

while d < userInput

result = [result, randi([0,1])];

d = sum(result .* (2.* ones(1, numel(result))).^(numel(result)-1 :-1:0));

end

end

Explanation:

  • Initialize the variables from 0 as a starting point.
  • Use a while to run it until d is less than userInput variable.
  • Add random 1's and 0's to the array.
  • Return the binary result when it's decimal equivalent is larger than the input number.
You might be interested in
Plz answer the following ​
Kruka [31]

Answer:

it trojan

Explanation:

what is the question asking

5 0
3 years ago
Read 2 more answers
2min speech on can teachers be replace by technology​
elena-s [515]

Answer:

The boom of online courses, where anyone can learn from the comfort of one’s own home or office at their own chosen time is the main cause. When online courses made their foray a decade ago, the same question of technology replacing teachers in schools emerged as a major argument. However, if we ask you today whether calculators can replace mathematics teachers at school, what would you say? Sounds weird, right! Do you think calculators which are also a kind of a technological advancement only, are capable enough of themselves, so as to replace the teachers? The answer is obvious. It’s an obvious No!

6 0
3 years ago
Which of the following statements concerning a short in a series circuit is true?
Romashka [77]

Answer:

what is the answers it gave you?

6 0
3 years ago
This script should:
denis23 [38]

Answer:

the answer is d

Explanation:

5 0
3 years ago
Which of the following is an example of a runtime error?
Rina8888 [55]

Answer:

missing quotation marks around a string literal

6 0
3 years ago
Other questions:
  • When you begin typing text, the _________________________ appears on the status bar with an animated pencil writing on paper tha
    15·1 answer
  • The spreadsheet ends after you reach column Z and row 99. True or false
    12·1 answer
  • Creating a call conversion in Google Ads and adding a phone snippet to a web page allows advertisers to use a Google forwarding
    11·1 answer
  • Justin has started a lawn mowing business in his neighborhood. He is running a weed-pulling special this month. What is the most
    8·2 answers
  • Plain text and ASCII text are the same thing. true or false
    12·1 answer
  • Examples of analog computer
    8·1 answer
  • Which code will print a random number between 1 and 100?
    15·2 answers
  • What's the difference between a robot and a machine?
    7·1 answer
  • Your worksheet contains a price in cell A5 and many formulas refer to that price how would you refer to that price in the formul
    12·1 answer
  • Edit the program provided so that it receives a series of numbers from the user and allows the user to press the enter key to in
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!