Ask 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 result when it's decimal equivalent is larger than the input number. [outArray] = potd11 (inputNumber)

+4
Answers (1)
  1. 11 May, 19:31
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers