Ask Question
14 August, 19:31

Write a user defined Matlab function that converts integers written in decimal form to binary form. Name the function b = Bina (d), where the input argument d is the integer to be converted and the output argument b is a vector with ones and zeros that represents the number in binary form. The largest number that could be converted with the function should be a binary number which 16 ones. If a large number is entered as d, the function should display an error message. Use the function to convert the following numbers: (a) 100 (b) 1002 (c) 52601 (d) 200,090

+3
Answers (1)
  1. 14 August, 22:51
    0
    function [b] = bina (d)

    % bina is a function that converts integers to binary

    %

    b = [];

    if d > = (2^16 - 1)

    fprintf ('This number is too big')

    else

    while d ~ = 0

    r=rem (d, 2);

    b=[r b];

    d = idivide (d, 2);

    end

    end

    end
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write a user defined Matlab function that converts integers written in decimal form to binary form. Name the function b = Bina (d), where ...” 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