Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. The cost per milefor a rental car is $0.50 for the first 100 miles, and $0.30 for the next 200 miles and $0.20 for

1. The cost per milefor a rental car is $0.50 for the first 100 miles, and $0.30 for the next 200 miles and $0.20 for all miles in excess of 300 miles. Write a script that asks the user to enter the mileage, calculate the total cost and print it on the screen. Use fprintfto display the cost.

image text in transcribed

When n resistors are connected in parallel, their equivalent resistance Req can b determined from: eq R1 R2 rL. Write a user-defined function that calculates Req. For the function name and argument use REQ req (R) . The input to function should be a vector in which each element i a resistor value, and the output from the function is Req. Use the function to calculate thi equivalent resistance when the following resistors are connected in parallel: 5, 15, 12,7Q, 50Q, and 75 The friction factor for incompressible flow through a smooth pipe is given below. The friction factor is used to calculate the pressure drop in a pipe. a. Write a MATLAB code that calculates the friction factor, f, given the Reynolds number (Re) using IF' statements. Re s 2100 2100 Re 105 Re 2 105 f (Re) 16/Re f (Re) -0.0791/Re0:25 f (Re) - 0.004 b. Write a MATLAB code that implements the function using 'IF ELSE statements c. Write a MATLAB code that implements the function using ' ELSEIF' statements

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

More Books

Students also viewed these Databases questions

Question

What is DDL?

Answered: 1 week ago