Question

part 1: Create Useful Functions. Create the following functions in MATLAB and use the function names...

part 1: Create Useful Functions.

Create the following functions in MATLAB and use the function names provided below!

kmout = MilesToKm(miles) % converts a value in miles to kilometers

kJoulesOut = CalTokJoules(DietaryCalories) % converts dietary calories (big calories) to kiloJoules (10^3 Joules = 1 kJ)

kWhrOut = KJoulesToKWHr(Kjoules) % converts kJoules to kilowatt hours

kmout = FeetTokm(feet) % converts feet to kilometers

secondsout = HoursToSeconds(hours) % converts hours to seconds

Each of the functions includ appropriate help comments that will respond to MATLAB's help command.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: Brother if you have any queries related the answer please do comment. I would be very happy to resolve all your queries.

1)

function kmout = MilesToKm(miles) % converts a value in miles to kilometers

kmout=miles*1.609;

end

2)

function kJoulesOut = CalTokJoules(DietaryCalories) % converts dietary calories (big calories) to kiloJoules (10^3 Joules = 1 kJ)

kJoulesOut=DietaryCalories*4.184;

end

3)

function kWhrOut = KJoulesToKWHr(Kjoules) % converts kJoules to kilowatt hours

kWhrOut=Kjoules/3600;

end

4)

function kmout = FeetTokm(feet) % converts feet to kilometers

kmout=feet/3280.84;

end

5)

function secondsout = HoursToSeconds(hours) % converts hours to seconds

secondsout=hours*3600;

end

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
part 1: Create Useful Functions. Create the following functions in MATLAB and use the function names...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Assignment: Do this assignment after reading zyBooks Chapter 3. Create the following functions in MATLAB and...

    Assignment: Do this assignment after reading zyBooks Chapter 3. Create the following functions in MATLAB and save them to your directory. You must use the function names provided below! Use the attached test script TestConversions.m to test your functions. kmout = MilesToKm(miles) % converts a value in miles to kilometers JoulesOut = CalToJoules(DietaryCalories) % converts dietary calories (big calories) to Joules kWhrOut = JoulesToKWHr(joules) % converts Joules to kilowatt hours metersout = FeetToMeters(feet) % converts feet to meters secondsout =...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT