Ask Question
26 December, 22:16

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)

+5
Answers (1)
  1. 27 December, 00:14
    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?
Get 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 & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers