Question

In: Computer Science

Write a user-defined MATLAB function, with two input and two output arguments that determines the height...

Write a user-defined MATLAB function, with two input and two output arguments that determines the height in centimeters (cm) and mass in kilograms (kg)of a person from his height in inches (in.) and weight in pounds (lb).

(a) Determine in SI units the height and mass of a 5 ft.15 in. person who weight 180 lb.

(b) Determine your own height and weight in SI units.

Solutions

Expert Solution

===============================================================

Matlab Script to copy:

% Matlab script to convert given mesurements into SI units

%(a) height and mass of a 5 ft.15 in. person who weight 180 lb in SI units

feetToInches = 5 * 12; % Converting feets to inches

height = feetToInches + 15; % Total height in inches

mass = 180; % Mass in pounds(lb)

[heightInCm, weightInKg] = measuresInSI(height, mass);

disp("Output (a):")

fprintf("Height in centimeters: %.2f", heightInCm)

fprintf("Weight in kilograms: %.2f", weightInKg)

%(b) My own height and weight in SI units

feetToInches = 5 * 12; % Converting feets to inches

height = feetToInches + 10; % Total height in inches

mass = 135; % Mass in pounds(lb)

[heightInCm, weightInKg] = measuresInSI(height, mass);

disp("Output (b):")

fprintf("Height in centimeters: %.2f", heightInCm)

fprintf("Weight in kilograms: %.2f", weightInKg)

function [height, weight] = measuresInSI(inches, pounds)

height = inches * 2.54; % 1 inch = 2.54 centimeters

weight = pounds * 0.45359237; % 1 pound(lb) = 0.45359237 kg

end

------------------------------------------------------------

Matlab script screenshot:

-------------------------------------------------------

Sample Output:

===================================================================

Hope it will helpfull and do comments for any additional info if needed. Thankyou

===================================================================


Related Solutions

Write a function that will receive two input arguments that is the height in inches (in.)...
Write a function that will receive two input arguments that is the height in inches (in.) and the weight in pounds (lb) of a person and return two output arguments that is the height in meters (m) and mass in kilograms (kg). Determine in SI units the height and mass of a 5 ft.15 in. person who weight 180 lb. Determine your own height and weight in SI units. Note: 1 meter = 39.3701 inch, 1 foot = 12 inches,...
MATLAB Write a user defined function for a projectile motion. If a ball is launched from...
MATLAB Write a user defined function for a projectile motion. If a ball is launched from initial position(0,0) with a velocity v0 at angle θ, determine your horizontal and vertical position. Please plot x vs. t, y vs. t and y vs. x.
Please solve the following problem for MATLAB Write a user-defined function that calculates the average and...
Please solve the following problem for MATLAB Write a user-defined function that calculates the average and the standard deviation of a list of numbers. Use the function to calculate the average and the standard deviation of the following list of grades : 80 75 91 60 79 89 65 80 95 50 81
Please solve the following problem for MATLAB Write a user-defined function (name it F to C)...
Please solve the following problem for MATLAB Write a user-defined function (name it F to C) that converts temperature in degrees F to temperature in degrees C. Use the function to solve the following problem. The change in the length of an object, ∆L, due to a change in the temperature, ∆T, is given by: ∆L = αL∆T, where a is the coefficient of thermal expansion. Determine the change in the area of a rectangular(4.5 m by 2.25m) aluminum (α=23·10-61/˚C)...
USE MATLAB Write a program in Matlab that would continuously ask the user for an input...
USE MATLAB Write a program in Matlab that would continuously ask the user for an input between 1 and 6, which would represent the result of rolling a die. The program would then generate a random integer between 1 and 6 and compare its value to the value entered by user. If the user’s die is larger, it should display, “Mahahanap mo na ang forever mo. Sana all!” If the user’s die is smaller, it should display, “Gising na friend,...
Write a user-defined MATLAB function that converts real numbers in decimal form to binary form. Name...
Write a user-defined MATLAB function that converts real numbers in decimal form to binary form. Name the function b = deciTObina (d), where the input argument d is the number to be converted and the output argument b is a 30-element-long vector with 1s and 0s that represents the number in binary form. The first 15 elements of b store the digits to the left of the decimal point, and the last 15 elements of b store the digits to...
In matlab please. It says that not enough arguments. How, what, and where to input? function...
In matlab please. It says that not enough arguments. How, what, and where to input? function longestword (word1,word2,word3) if strlength(word1) > strlength(word2) && strlength(word1) > strlength(word3) fprintf(word1); elseif strlength(word2) > strlength(word1) && strlength(word2) > strlength(word3) fprintf(word2); else fprintf(word3) end end
Write a user defined MATLAB program that performs power factor correction. The inputs to the MATLAB...
Write a user defined MATLAB program that performs power factor correction. The inputs to the MATLAB function should be voltage across the load (in Vrms, assume 0 phase), frequency Resistance of the load Inductance of the load power factor of the load target power factor The output of the function should be the size of the capacitor that one would need to place in parallel with the load to reach the target power factor. Please submit the code for the...
Write a user-defined function named printBox that, when called, will output the following sequence of characters:...
Write a user-defined function named printBox that, when called, will output the following sequence of characters: OOOOOOOO OOOOOOOO OO            OO OO            OO OOOOOOOO OOOOOOOO Write a user-defined function named printArrow that, when called, will accept an integer called arrowSize and will output a sequence of *’s such that there are arrowSize number of rows with the number of * incrementing, and then arrowSize-1 rows with the number of * decrementing: If arrowSize = 3, then the output is: * **...
Write a user-defined MATLAB function that uses classical fourth order Runge-Kutta method to solve a first...
Write a user-defined MATLAB function that uses classical fourth order Runge-Kutta method to solve a first order ODE problem dydx = f(x, y) in a given interval a ? x ? b with initial condition y(a) = y0 and step size of h. For function name and arguments, use [x,y] = myrk4(f, a, b, h, y0) Check your function to find the numerical solution for dydx=?1.2y+7e^(?0.3x) in the interval 0 ? x ? 4 with initial condition y(0)=3. Run your...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT