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

Assignment Help Civil Engineering
Reference no: EM13317846

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: EM13317846

Questions Cloud

What is the smallest diameter particle of specific gravity : 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. What is the smallest diameter particle of specific gravity 1.4
Determine time to reach maximum height : A projectile is fired with an initial speed of 113 m/s at an angle of 60 degrees above the horizontal, from the top of a cliff which is 49.0 meters high. determine time to reach maximum height
Calculate the total head the pump is pumping against : A pump has the following pump curve is pumping at a rate of 5000gpm. Calculate (a) the total head the pump is pumping against. (b) brake horsepower required to drive the pump.
What is the weight of the truck : A small ferryboat is 4.00 m wide and 6.00 m long. When a loaded truck pulls onto it, the boat sinks an additional 4.60 cm into the river
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 n_factorial=1
Find its youngs modulus : For safety in climbing, a mountaineer uses a nylon rope that is 60 m long and 1.0 cm in diameter. Find its Young's modulus
Which object has the greater final speed : Starting from rest, object 1 is subject to a 10Nforce for 2.0 s. Object 2, with twice the mass, is subject to a 15N force for 3.0 s
How does this event affect the demand for money : If the fed does not respond to this event what will happen to the price level?
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. The bonds have a call date of this year if GSI decides to take advantage of it.

Reviews

Write a Review

Civil Engineering Questions & Answers

  Find the theoretical minimum amount of chlorine required

A stream with a flow of 22 mgd contains 180 mg/L of sodium cyanide in the form of NaCN. Chlorine can be added to destroy the NaCN waste according to the reaction shown below. Find the theoretical minimum amount of chlorine required (in lb/day).

  Determining optimal solution

The company would like to distribute the songs between the two CDs such that the used space on each CD is about the same. Formulate the problem as an IP, and find the optimal solution.

  Plot height of water in the container as function of time

At the bottom, an opening allows water to drain out at a rate, in lbm/s, that is proportional to H(t), the instantaneous height of water in the barrel, in ft: rate of water leaving from bottom = 9*H(t) .

  Find final velocity in mph if the drop height is increased

given: Vf=Vi + a t and Sf=Si + Vi t + 1/2 a t a= 27 ft/sec^2 accelerates from 10 mph to 93 mph in 4.5 seconds designers decided to modify the rise to become the tallest roller coaster in the world, find final velocity in mph if the drop height is ..

  How to show the oscillation of each of the systems

mechanical oscillations can be described in general by the following function: y(t)= e^(-t/m) *sin(wt+phi). where (t) is time and (w) is the oscillation angular frequency in radians per unit time.

  Analyze the situation with regard to both budget nd schedule

A mason contracted with a general contractor to build an exterior wall from 8-inch CMUs. The wall is 82 feet long and 8 feet high.16The mason must finish the wall in 3 days and gets paid $4 per block.

  Solve for deflection and reactions using partitioned form

For the FE pin-pin cable model, solve for the deflection and reactions using the partitioned form. What is partitioned form

  Complete cycle of the motion

Find the time for one complete cycle of this motion if the spring constant is 21 N/m. (Assume that once the pendulum ball hits the spring there is no effect due to the vertical movement of the ball.)

  Determine the percentage increase in the discharge the ditch

As part of a drainage improvement project, a drainage ditch will be straightened and cleaned. As a result, the lenght of the ditch will decrease from 1800 ft to 1400 ft and the mannings roughness factor will be reduced to 0.018 from 0.022.

  Determine hydraulic retention time in the treatment system

The BOD5 of the influent wastewater is 150 mg/L and the first-order reaction rate for the degradation of BOD5 is 0.6/hr at 20°C. If the required effluent BOD5 is 20mg/L

  Depict a decision tree

The mine's operating costs were projected at $900,000 per year including $400,000 of fixed costs and $500,000 of variable costs. Ms. Peru thought these forecasts accurate.

  Determine the allowable value of the tensile load p

A steel bar serving as a vertical hanger to support heavy machinery in a factory is attached to a support by the bolted connection. The main part of the hanger has a rectangular cross section with width b1 = 1.5 in. and thickness t = 0.5 in.

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