Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this expression, we note that the conversion factor, 0.453592, has six digits after the decimal point. Depending on the application, when displaying the

image

In this expression, we note that the conversion factor, 0.453592, has six digits after the decimal point. Depending on the application, when displaying the converted weight, we may or may not want to display that many digits. a) Using the fprintf statement and the %f conversion specification, create a MATLAB script that displays the weight in kg with exactly 3 digits after the decimal point. For example if the weight in pounds is 150, then the weight in kg should be displayed as Weight = 68.039 kg Note your fprintf statement should be in terms of a variable, not only constants. Paste your code here: b) Now suppose we have an array of four weights in kg that we want to convert to pounds and display with no digits after the decimal point. Create a MATLAB script that loops over the values in the array and displays the original kg values with 1 digit after the decimal as well as the weight in pounds with no digits after the decimal. Suppose the weight (in kg) array is composed of the following values: [50.543 65.676 75.343 80.937] Then your output should look like the following: 50.5 kg = 111 lbs 65.7 kg = 145 lbs 75.3 kg = 166 lbs 80.9 kg = 178 lbs Submit your script as an .m file in addition to this pdf. Additionally, paste your code here - include a comment for each and every line:

Step by Step Solution

3.41 Rating (157 Votes )

There are 3 Steps involved in it

Step: 1

script1 Matlab script code that prints the weight in kg fro... 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

Step: 3

blur-text-image

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

Labor and Employment Law Text and Cases

Authors: David Twomey

15th edition

1133188281, 978-1133711841, 1133711847, 978-1285247632, 978-1133188285

More Books

Students also viewed these Programming questions

Question

What is the driving force for mountain building in the Andes?

Answered: 1 week ago