Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

function v = rebaseInteger(n,b,m) Question 1. Write a Matlab function that converts a non negative integer written in decimal base to its equivalent form expressed

image text in transcribed

function v = rebaseInteger(n,b,m)

Question 1. Write a Matlab function that converts a non negative integer written in decimal base to its equivalent form expressed on an arbitrary base b10. Store the output in a vector. On input, the function must accept the number n, the base b, and the maximum number of digits m. On output, the function must return a vector of length m. If the number causes an overflow (i.e., it is bigger than what can be represented with m digits on that base), the vector must be filled with NaNs. The program must check that b>1. If b1 it must return a vector of 1 's. The return expression must contain the Most Significant Digit in the first entry of the vector. For example, if the number is 99=181+29, the base is 3 and m=7, then the answer is [0010200]. For the same number, but the base is 5 and m=4

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

T Sql Fundamentals

Authors: Itzik Ben Gan

4th Edition

0138102104, 978-0138102104

More Books

Students also viewed these Databases questions