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

  Derive this equation from the basic material

Absolute value signs serve as a reminder that, at this point Td and Te must be expressed as absolute temperatures.

  How large could the plant be without having the ground

A 35 percent-efficient coal-fired power plant with effective height of 100 m emits SO2 at a rate of 0.6 lb/10^6 Btu into the plant. If winds are assumed to be 4 m/s at the stack height and just over 3 m/s at 10 m

  A cantilever beam is additionally supported using

A cantilever beam is additionally supported using two tierods. Both rods attach to the end of the beam. One rod comes off at 45 degrees and attaches

  Estimate the required volume of the aeration tank

A town is going to upgrade its primary WWTP to a secondary plant that can meet the effluent standard of 25 mg/L BOD5 and 30 mg/L suspended solids. They have selected a CSTR activated sludge system for the upgrade.

  Determine what is the expected cycle service level

Demand for a particular product is normally distributed with a mean of 100 units and a standard deviation of 20 per period. if there are 120 units in inventory at the beginning of this period

  Cstr reactors of equal volume in series

Compare the total reactor volume required for 90% removal of the same pollutant in a CSTR system that contains a single reactor against a system that contains three CSTR reactors of equal volume in series.

  Calculate speed of the shockwave foamed by the bottleneck

When stationary, vehicles are spaced at average distance headway of 6 m. It may be assumed that there is a linear relationship between speed and density. When the traffic flow approaching the roadworks is 3500 vehicles per hour

  Compute the station and elevation of the curve turning point

Set up a table showing curve elevations at the PVC, at the PVT, and at the half-station points along the curve. Compute the station and elevation of the curve turning point.

  Calculate the work produced and heat rejected by this engine

A completely reversible heat engine uses a solar receiver for a hightemperature reservoir and a lake for a low temperature reservoir. The sun maintains the receiver surface at 290 ° F while the lake remains at 40 °F.

  Calculate the surface area and hydraulic retention time

Calculate the surface area (m2), diameter (m), volume (m3), and hydraulic retention time of a 3 m deep circular, primary clarifier that would remove 50 percent of suspended solids. Assume the surface overflow rate (SOR) used for design is 60 m3/m2-..

  A continuously reinforced concrete pavement cross section

what is your recommendation for the maximum size of coarse aggregate for the following situation? a continuously

  How many cubic yards of aggregate must be ordered

how many cubic yards of aggregate must be ordered for a road base 16 inches thick and 2000 feet long with a top width of 30 ft, if the side slopes are one on one, or 45 degree

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