Question: Use Matlab to answer this question 1. Dene a recursive function myrecdec2bin that transforms a nonnegative integer into its binary representation dened as a binary
Use Matlab to answer this question

1. Dene a recursive function myrecdec2bin that transforms a nonnegative integer into its binary representation dened as a binary vector. 2. Use myrecdec2bin to display, for X varying from 1 to 20, x, myrecdec2bin(x) and mybin2dec(myrecdec2bin(x)) (that should be equal to X). 3. Comment quickly about the number of iterations your recursive function takes to ensure its complexity is roughly the same as the iterative method. In the following, we propose experiments to compare the CPU time taken by the iterative and the recursive methods. The strategy is as follows: we will edit a random vector TEST of length 100 and integral components between 0 and 107. Then, for each of these 100 random values, we will run the two functions mydec2bin and myrecdec2bin and compare the CPU time
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
