Question: For this second module you'll be writing a user - defined function in MATLAB that can perform the same unit conversions you did for module

For this second module you'll be writing a user-defined function in MATLAB that can perform the same unit conversions you did for module 1. You'll again be using the same conversion formulae as you did for module 1, which are given to you in Table I: Table I: Imperial to metric (and vice-versa) conversion formulae Youve been provided with the following declaration for your function myunitconv() in MATLAB Grader: function [numout, unit]= myunitconv(numin, convtype) This function declaration states that: There shall be Two (2) output variables (numout and unit) corresponding to the converted number (a double-precision floating point number) and its new unit (character array) respectively. There shall also be Two (2) input variables (numin and convtype) corresponding to the number you want to convert (a double-precision floating point number) and the conversion-type to apply (character array) respectively. All valid conversion-type char arrays along with their output unit char arrays are given in Table II: Table II: Conversion-type inputs available for unit converter program with units Write a function that will perform the appropriate unit conversion process (convtype) for the number that has been input by MATLAB Grader (numin). Ensure your function returns both the converted value (numout) along with the unit relating to this output number (unit). You must not use the MATLAB in-built converter functions (e.g. unitConvert(), convlength(), convacc(), convvel(), convtemp(), or convmass()). Important Note: Do not use the keywords clear or clc in your solution.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!