Answered step by step
Verified Expert Solution
Question
1 Approved Answer
( 8 points ) Use a for - loop to define a function to convert a text representing a binary number to decimal integer, and
points Use a forloop to define a function to convert a text representing a binary number to
decimal integer, and then test it as described below.
Write a userdefined MATLAB function named mybindec that takes one single
valued text input argument representation of a binary number and converts it to a
decimal integer. You are not allowed to use MATLAB bindec function in your
function definition, but can use it to check whether your function works correctly.
Write a MATLAB script file that calls mybindec function and prints to the screen the
values of binary numbers in the range of to ie to in decimal
Hint: you can use a for loop and the MATLAB function decbin to generate the binary
numbers in the range specified above.
What to submit for this question: Please submit a plain text file named aqtxt that
contain the contents of both the function file and the script file. Note that, to run the program,
you need to have two separate files. But to submit them, you need to combine them by copy
and paste into the txt file to save paper when the TA prints them out.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started