# 6.1 Problem set

 Page 1 / 1
Problem Set for Numerical Integration with MATLAB

Let the function y defined by $y=\cos x$ . Plot this function over the interval [-pi,pi]. Use numerical integration techniques to estimate the integral of y over [0, pi/2]using increments of pi/10 and pi/1000.

1. Plotting: x=-pi:pi/100:pi; y=cos(x);plot(x,y),title('Graph of y=cos(x)'),xlabel('x'),ylabel('y'),grid
2. Area calculation 1: >>x=0:pi/10:pi/2;>>y=cos(x);>>area1=trapz(x,y) area1 =0.9918
3. Area calculation 2: >>x=0:pi/1000:pi/2;>>y=cos(x);>>area2=trapz(x,y) area2 =1.0000

Let the function y defined by $y=0.04x^{2}-2.13x+32.58$ . Plot this function over the interval [3,30]. Use numerical integration techniques to estimate the integral of y over [3,30].

1. Plotting: >>x=3:.1:30;>>y=0.04*(x.^2)-2.13.*x+32.58;>>plot(x,y), title('Graph of ... y=.04*(x^2)-2.13*x+32.58'),xlabel('x'),ylabel('y'),grid
2. Area calculation: >>area=trapz(x,y) area =290.3868

A 2000-liter tank is full of lube oil. It is known that if lube oil is drained from the tank, the mass flow rate will decrease from the maximum when the tank level is at the highest. The following data were collected when the tank was drained.

Time [min] Mass Flow [kg/min]
0 50.00
5 48.25
10 46.00
15 42.50
20 37.50
25 30.50
30 19.00
35 9.00

Write a script to estimate the amount of oil drained in 35 minutes.

clc t=linspace(0,35,8) % Data entry for time [min]m=[50 48.25 46 42.5 37.5 30.5 19 9] % Data entry for mass flow [kg/min]% Calculate time intervals dt=[t(2)-t(1),t(3)-t(2),t(4)-t(3),...t(5)-t(4),t(6)-t(5),t(7)-t(6),t(8)-t(7)] % Calculate mass outdm=[0.5*(m(2)+m(1)),0.5*(m(3)+m(2)),0.5*(m(4)+m(3)),0.5*(m(5)+... m(4)),0.5*(m(6)+m(5)),0.5*(m(7)+m(6)),0.5*(m(8)+m(7))]% Calculate differential areas da=dt.*dm;% Tabulate time and mass flow [t',m']% Tabulate time intervals, mass out and differential areas [dt',dm',da']% Calculate the amount of oil drained [kg] in 35 minutesOil_Drained=sum(da) The output is: ans = 0 50.00005.0000 48.2500 10.0000 46.000015.0000 42.5000 20.0000 37.500025.0000 30.5000 30.0000 19.000035.0000 9.0000 ans =5.0000 49.1250 245.6250 5.0000 47.1250 235.62505.0000 44.2500 221.2500 5.0000 40.0000 200.00005.0000 34.0000 170.0000 5.0000 24.7500 123.75005.0000 14.0000 70.0000 Oil_Drained =1.2663e+003

A gas is expanded in an engine cylinder, following the law PV 1.3 =c. The initial pressure is 2550 kPa and the final pressure is 210 kPa. If the volume at the end of expansion is 0.75 m 3 , compute the work done by the gas. Applied Heat for Engineers by W. Embleton and L Jackson, Thomas Reed Publications. © 1999, (p. 80)

clc disp('A gas is expanded in an engine cylinder, following the law PV^1.3=c')disp('The initial pressure is 2550 kPa and the final pressure is 210 kPa.') disp('If the volume at the end of expansion is 0.75 m3,') disp('Compute the work done by the gas.')disp(' ') % Display blank line n=1.3;P_i=2550; % Initial pressure P_f=210; % Final pressureV_f=.75; % Final volume V_i=(P_f*(V_f^n)/P_i)^(1/n); % Initial volumec=P_f*V_f^n; v=V_i:.001:V_f; % Creating a row vector for volume, vp=c./(v.^n); % Computing pressure for volume WorkDone=trapz(v,p) % Integrating p*dv The output is: A gas is expanded in an engine cylinder, following the law PV^1.3=c The initial pressure is 2550 kPa and the final pressure is 210 kPa.If the volume at the end of expansion is 0.75 m3, Compute the work done by the gas.WorkDone =409.0666

A force F acting on a body at a distance s from a fixed point is given by $F=3s+\frac{1}{s^{2}}$ . Write a script to compute the work done when the body moves from the position where s=1 to that where s=10. O. N. Mathematics: 2 by J. Dobinson, Penguin Library of Technology. © 1969, (p. 213)

clc disp('A force F acting on a body at a distance s from a fixed point is given by')disp('F=3*s+(1/(s^2)) where s is the distance in meters') disp('Compute the total work done in moving')disp('From the position where s=1 to that where s=10.') disp(' ') % Display blank lines=1:.001:10; % Creating a row vector for distance, s F=3.*s+(1./(s.^2)); % Computing Force for sWorkDone=trapz(s,F) % Integrating F*ds over 1 to 10 meters. The output is: A force F acting on a body at a distance s from a fixed point is given by F=3*s+(1/(s^2)) where s is the distance in metersCompute the total work done in moving From the position where s=1 to that where s=10.WorkDone =149.4000

The pressure p and volume v of a given mass of gas are connected by the relation $(p+\frac{a}{v^{2}})(v-b)=k$ where a, b and k are constants. Express p in terms of v, and write a script to compute the work done by the gas in expanding from an initial volume to a final volume. O. N. Mathematics: 2 by J. Dobinson, Penguin Library of Technology. © 1969, (p. 212)

Test your solution with the following input:
a: 0.01
b: 0.001
The initial pressure [kPa]: 100
The initial volume [m3]: 1
The final volume [m3]: 2

clc % Clear screen disp('This script computes the work done by')disp('The gas in expanding from volume v1 to v2') disp(' ') % Display blank linea=input('Enter the constant a: '); b=input('Enter the constant b: ');p_i=input('Enter the initial pressure [kPa]: ');v_i=input('Enter the initial volume [m3]: ');v_f=input('Enter the final volume [m3]: ');k=(p_i+(a/(v_i^2))*(v_i-b)); % Calculating constant k v=v_i:.001:v_f; % Creating a row vector for volumep=(k./(v-b))-(a./(v.^2)); % Computing pressure for volume WorkDone=trapz(v,p); % Integrating p*dvdisp(' ') % Display blank line str = ['The work done by the gas in expanding from ', num2str(v_i),...' m3 to ' num2str(v_f), ' m3 is ', num2str(WorkDone), ' kW.'];disp(str); The output is: This script computes the work done by The gas in expanding from volume v1 to v2Enter the constant a: .01Enter the constant b: .001 Enter the initial pressure [kPa]: 100 Enter the initial volume [m3]: 1 Enter the final volume [m3]: 2The work done by the gas in expanding from 1 m3 to 2 m3 is 69.3667 kW.

#### Questions & Answers

Is there any normative that regulates the use of silver nanoparticles?
Damian Reply
what king of growth are you checking .?
Renato
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
Stoney Reply
why we need to study biomolecules, molecular biology in nanotechnology?
Adin Reply
?
Kyle
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
Adin
why?
Adin
what school?
Kyle
biomolecules are e building blocks of every organics and inorganic materials.
Joe
anyone know any internet site where one can find nanotechnology papers?
Damian Reply
research.net
kanaga
sciencedirect big data base
Ernesto
Introduction about quantum dots in nanotechnology
Praveena Reply
what does nano mean?
Anassong Reply
nano basically means 10^(-9). nanometer is a unit to measure length.
Bharti
do you think it's worthwhile in the long term to study the effects and possibilities of nanotechnology on viral treatment?
Damian Reply
absolutely yes
Daniel
how to know photocatalytic properties of tio2 nanoparticles...what to do now
Akash Reply
it is a goid question and i want to know the answer as well
Maciej
characteristics of micro business
Abigail
for teaching engĺish at school how nano technology help us
Anassong
Do somebody tell me a best nano engineering book for beginners?
s. Reply
there is no specific books for beginners but there is book called principle of nanotechnology
NANO
what is fullerene does it is used to make bukky balls
Devang Reply
are you nano engineer ?
s.
fullerene is a bucky ball aka Carbon 60 molecule. It was name by the architect Fuller. He design the geodesic dome. it resembles a soccer ball.
Tarell
what is the actual application of fullerenes nowadays?
Damian
That is a great question Damian. best way to answer that question is to Google it. there are hundreds of applications for buck minister fullerenes, from medical to aerospace. you can also find plenty of research papers that will give you great detail on the potential applications of fullerenes.
Tarell
what is the Synthesis, properties,and applications of carbon nano chemistry
Abhijith Reply
Mostly, they use nano carbon for electronics and for materials to be strengthened.
Virgil
is Bucky paper clear?
CYNTHIA
carbon nanotubes has various application in fuel cells membrane, current research on cancer drug,and in electronics MEMS and NEMS etc
NANO
so some one know about replacing silicon atom with phosphorous in semiconductors device?
s. Reply
Yeah, it is a pain to say the least. You basically have to heat the substarte up to around 1000 degrees celcius then pass phosphene gas over top of it, which is explosive and toxic by the way, under very low pressure.
Harper
Do you know which machine is used to that process?
s.
how to fabricate graphene ink ?
SUYASH Reply
for screen printed electrodes ?
SUYASH
What is lattice structure?
s. Reply
of graphene you mean?
Ebrahim
or in general
Ebrahim
in general
s.
Graphene has a hexagonal structure
tahir
On having this app for quite a bit time, Haven't realised there's a chat room in it.
Cied
what is biological synthesis of nanoparticles
Sanket Reply
how did you get the value of 2000N.What calculations are needed to arrive at it
Smarajit Reply
Privacy Information Security Software Version 1.1a
Good
Berger describes sociologists as concerned with
Mueller Reply
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

### Read also:

#### Get the best Algebra and trigonometry course in your pocket!

Source:  OpenStax, A brief introduction to engineering computation with matlab. OpenStax CNX. Nov 17, 2015 Download for free at http://legacy.cnx.org/content/col11371/1.11
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'A brief introduction to engineering computation with matlab' conversation and receive update notifications?          