Write an m-file to calculate the factorial function of n

Assignment Help Civil Engineering
Reference no: EM13549249

Write an M-file to calculate the factorial function of N!, as defined by: N!=1 N=0 N!=N*(N-1)*(N-2)*...*3*2*1 N>0 The MATLAB code to calculate N factorial for positive value of N would be n_factorial=1 for 11=1:n n_factorial=n_factorial*ii; end Be sure to handle the special case of 0! Alos, be sure to report and error if N is negative or not and integer

Reference no: EM13549249

Questions Cloud

Friction between the floor and the base of the ladder : Modify function random0 so that it can accept 0, 1, or 2 calling arguments. If it has no calling arguments, it should return a single random value. If it has 1 or 2 calling arguments, it should behave as it currently does.
What is the estimated uncertainty in the length of this : The base line vector between the base and roving reciever is 8340m and has an accuracy of +/-(1to 2 cm +/-2ppm). What is the estimated uncertainty in the length of this vector?
What is the terminal settling velocity of a particle with : What is the terminal settling velocity of a particle with a specific gravity of 1.4 and a diameter of 0.01 mm in 20 degrees celcius water?
Use the gamma of water is equal to 1000 kg/m^3 : A horizontal 150mm pipe, in which 40 l/s of oil (S=.8) is flowing, contracts to a 75 mm diameter (left to right). If the pressure in the 150mm pipe is 300kPa, calculate the magnitude and direction of the horizontal force exerted on the contraction
Write an m-file to calculate the factorial function of n : Write an M-file to calculate the factorial function of N!, as defined by: N!=1 N=0 N!=N*(N-1)*(N-2)*...*3*2*1 N>0 The MATLAB code to calculate N factorial for positive value of N would be
Determine if the heat pump is reversibl, irreversible : A heat pump is used to heat a room where the outside temperature is -10°C. If the heat pump requires a power input of 2 kW, and the room requires a heat input of 15 kW to maintain the temperature at 25°C,
Determine the rate of return that the company will make : Five years ago, GSI, an oil services company headquartered in Texas, issued $10 million worth of 12% 30-year bond with the dividend payable quarterly.
What will be the time-mean speed and space-mean speed for : Assume you are an observer standing at a point along a three-lane roadway. All vehicles in lane 1 are travelling at 30 mi/h, all vehicles in lane 2 are travelling at 45 mi/h, and all vehicles in lane 3 are travelling at 60 mi/h. There is also a const..
Determine space mean speed : Data obtained from aerial photography showed six vehicles on a 600 ft long section of road. Traffic data collected at the same time indicated an average time headway of 4 sec. Determine the (a) density on the highway (b) flow on the road (c) space me..

Reviews

Write a Review

Civil Engineering Questions & Answers

  Calculate max capillary rise of water between 2 glass plates

Calculate the max capillary rise of water between 2 verticle glass plates spaced .25mm apart and the minimum capillary drop if the same plates are placed .25mm apart are in mercury

  How accurately would each 100-ft distance have to be measure

How accurately would each 100-ft distance have to be measured so that the 95% error would no exceeded +-0.24ft in a total distance of 4000ft

  Calculate the maximum length

The elevation of the lowest bottom of the structure is at 1470 feet. Calculate the maximum length (feet) of the parabolic curve required to meet the given conditions.

  Will any buildings in the rest of the town

A paper plant is proposed for a location 1 km upwind from a town.  It will emit 40 g/s of hydrogen sulfide, which has an odor threshold of about 0.1 mg/m 3.  Winds at the effective stack are typically 4 m/s owing toward the town.

  Determine the overturning moment of silt and water

Assuming that silt is equivalent to a liquid having a density of 1760 kg/m3, determine the overturning moment of silt and water about point A.

  Compute change in internal energy when 12 liters of argon

Using the DeHoff method, compute the change in internal energy when 12 liters of argon gas at 273 K and 1 atm is compressed to 6 liters with the final pressure equals to 10 atm. Assume argon behaves ideally and CV = 3/2·R.

  What is the residence time of air in the room if rate is use

On average each student produces 1 kg of carbon dioxide per day. The recommended ventilation rate of fresh air to avoid excessive carbon dioxide buildup is 8 L per second per student.

  What is the stress in the steel the stress in the concrete

A reinforced concrete column has 6 steel rods inserted in the column and the apparatus is subjected to a temperature drop of 90degrees F. from its stress free state.

  Determine the values of theta dot and theta dot at instant

The plate OAB forms an equilateral triangle which rotates counterclockwise with increasing speed about point O. If the normal and tangential components of acceleration of the centroid C

  Describe did the water depth increase or decrease

For each of the following transitions, draw E2,y2 on the specific energy chart and fully describe the reasoning. a. In a rectangular channel, there is a sudden drop in the channel bottom. Did the water depth increase or decrease

  Engineering ethics course where we have to select a case

engineering ethics course where we have to select a case related to civil engineering with reference to it and discuss

  Find the conjugate depth to an initial flow depth

A trapezoidal channel having bottom width of 8 m and side slopes of 1 : 1, carries a discharge of 80 m^3/s. Find the conjugate depth to an initial flow depth of 0.75 m before the jump.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd