<< Chapter < Page Chapter >> Page >
Problem Set for Numerical Integration with MATLAB

Let the function y defined by y 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.04 x 2 2.13 x 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.

Data
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 3 s 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 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

where we get a research paper on Nano chemistry....?
Maira Reply
what are the products of Nano chemistry?
Maira Reply
There are lots of products of nano chemistry... Like nano coatings.....carbon fiber.. And lots of others..
learn
Even nanotechnology is pretty much all about chemistry... Its the chemistry on quantum or atomic level
learn
Google
da
no nanotechnology is also a part of physics and maths it requires angle formulas and some pressure regarding concepts
Bhagvanji
Preparation and Applications of Nanomaterial for Drug Delivery
Hafiz Reply
revolt
da
Application of nanotechnology in medicine
what is variations in raman spectra for nanomaterials
Jyoti Reply
I only see partial conversation and what's the question here!
Crow Reply
what about nanotechnology for water purification
RAW Reply
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
Damian
yes that's correct
Professor
I think
Professor
Nasa has use it in the 60's, copper as water purification in the moon travel.
Alexandre
nanocopper obvius
Alexandre
what is the stm
Brian Reply
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
Rafiq
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
Damian
How we are making nano material?
LITNING Reply
what is a peer
LITNING Reply
What is meant by 'nano scale'?
LITNING Reply
What is STMs full form?
LITNING
scanning tunneling microscope
Sahil
how nano science is used for hydrophobicity
Santosh
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
Rafiq
what is differents between GO and RGO?
Mahi
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
Rafiq
if virus is killing to make ARTIFICIAL DNA OF GRAPHENE FOR KILLED THE VIRUS .THIS IS OUR ASSUMPTION
Anam
analytical skills graphene is prepared to kill any type viruses .
Anam
Any one who tell me about Preparation and application of Nanomaterial for drug Delivery
Hafiz
what is Nano technology ?
Bob Reply
write examples of Nano molecule?
Bob
The nanotechnology is as new science, to scale nanometric
brayan
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Damian
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
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
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

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?

Ask