(a) Write a user-defined MATLAB function that converts positive integers written in decimal form to Quaternary form. Your function should  take any positive integer, i.e. greater or equal to zero, as an input, and output a vector with digit entries, '0', '1', '2', or '3', which represent the Quaternary representation of your input. So, using the example above, the output of the function for the input '39' would be [2, 1, 3]. (b)Write a Matlab program in a script file that determines if a number is divisible by 4, by examining its Quaternary form. It is easy to show that a number is divisible by 4 if its least significant digit is 0.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter12: Adding Functionality To Your Classes
Section12.5: Virtual Functions
Problem 3E
icon
Related questions
Question

(a) Write a user-defined MATLAB function that converts positive integers written in decimal form to Quaternary form. Your function should  take any positive integer, i.e. greater or equal to zero, as an input, and output a vector with digit entries, '0', '1', '2', or '3', which represent the Quaternary representation of your input. So, using the example above, the output of the function for the input '39' would be [2, 1, 3].

(b)Write a Matlab program in a script file that determines if a number is divisible by 4, by examining its Quaternary form. It is easy to show that a number is divisible by 4 if its least significant digit is 0.

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Knowledge Booster
Bare Bones Programming Language
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr