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
What the benefits of folder when working with files
sasho [114]
It helps to keep things organized
3 0
4 years ago
Read 2 more answers
Which of the following is NOT a rule you should follow when creating a presentation?
Nataly_w [17]
False, Write in full sentences and paragraphs on your slides - It is your presentation! Make it how you want to 
8 0
3 years ago
Which one of the following analog VOM ranges would be selected to measure a DC
tensa zangetsu [6.8K]
<span>100 mA of course. You cannot use 10 mA because it will be over the range and the higher ranges are not accurate at 90 mA</span>
7 0
3 years ago
A file extension of .xlsx means that the file contains what?
laiz [17]

A .xlsx file tells you that the file is an Excel workbook that utilizes XML files to create the various spreadsheets as well as macros and other hidden codes used to perform certain functions (which is why there's an X at the end; older .xls files had no indication of this external code being present, which is why they're almost never recommended for modern use).

3 0
3 years ago
Difference between server and a client computer
maw [93]

Answer:

A server stores data for a client computer to access and use, and pretty self eplanitory for a client computer

Explanation:

5 0
3 years ago
Other questions:
  • Why are video texts an example of multimedia? A. They use audio and visual elements together. B. They use one type of medium to
    13·2 answers
  • Amanda, a project manager, conducted a team meeting consisting of testing and development team. She insisted on clear communicat
    11·1 answer
  • As the team leader, John ensures that all his teammates are clear in the team goals they need to achieve. He demonstrates the qu
    12·2 answers
  • The use of electronic media, information, and communication technologies to deliver instruction where students are not required
    8·1 answer
  • Given the declarations struct BrandInfo { string company; string model; }; struct DiskType { BrandInfo brand; float capacity; };
    11·1 answer
  • Which term describes the distance from one point on a wave to the same point on the next wave?
    13·2 answers
  • What is the result of executing the following code? You can assume the code compiles and runs. #include using namespace std; voi
    6·1 answer
  • An IT suspects that an unauthorized device is connected to a wireless network. This is a result of pastry sharing on a device br
    13·1 answer
  • Which of the following described a global network connecting billions of computers and other
    10·2 answers
  • You work part-time at a computer repair store. You're building a new computer. The customer has requested two serial ATA (SATA)
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!