Ask Question
21 September, 23:36

matlab Write a function that iteratively appends random 1's and 0's to an array to form a binary number. The function returns the binary result when it's decimal equivalent is larger than the input number. [outArray] = potd11 (inputNumber)

+1
Answers (1)
  1. 22 September, 01:22
    0
    function [outArray] = potd11 (inputNumber)

    outArray = [0];

    d = 0;

    while d < inputNumber

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

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

    end

    end
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “matlab Write a function that iteratively appends random 1's and 0's to an array to form a binary number. The function returns the binary ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers