2 views

Uploaded by Melvin Shady Pereira

nkkl

- Problem Set 8
- Electrical
- 122 - Documentation Rhinogold Analyze
- ap calculus bc syllabus
- ISOPE-P-90-092
- Integration_by_parts.pdf
- Surface Area
- June 2008 P1
- Inequalities (seoncadry)
- MAT 191
- integral.pdf
- Maths
- ISI_M.S
- Curriculum Map Math 7+ 16-17
- Cauchys Theorem
- c4-3
- matlab part2
- Gr7 Errata
- Geller Geus Productive Errors 2012
- bk8_19

You are on page 1of 3

-----------------------')

disp('This is a integration program.')

disp('It calculates the area under the curve based on the data you

have input.')

disp('This program calculates the area under the curve using 3 methods

which is;.')

disp('1) Built in Integration function int().')

disp('2) Built in trapezoidal Rule function trapz().')

disp('3) Using Numerical integration.')

disp('Follow the instructions carefully.')

disp('Programmed by Melvin Pereira.')

disp('Enjoy and have fun!!')

syms x;

a0=input('Please enter the lower limit: ');

b0=input('Please enter the upper limit: ');

while(a0>b0)

disp('Invalid input!!');

disp('Upper limit must be higher than lower limit')

a0=input('Please enter the lower limit: ');

b0=input('Please enter the upper limit: ');

end

n=input ('Please enter number of intervals: ');

while(n<2)

disp('Invalid input!!');

disp('Number of intervals must be greater or equal to 2');

n=input ('Please enter number of intervals: ');

end

a=a0;

b=b0;

y = ((2.39e-11)./((power(x,5)).*(exp(1.432./(3500.*x))-

1)));

a2 = double(int(y,a,b));

fprintf('The area under the curve using built in

integration function for the given y function with boundaries %g and

%g : %0.3f\n',a0,b0,a2)

clear x;

clear y;

a=a0;

b=b0;

xx=linspace(a,b,n+1);

y = ((2.39e-11)./((power(xx,5)).*(exp(1.432./(3500.*xx))-

1)));

z = trapz(xx,y);

fprintf('The area under the curve using built in

trapezoidal rule function for the given y function with boundaries %g

and %g : %0.3f\n',a0,b0,z)

clear x;

clear y;

a=a0;

b=b0;

y = @(x)((2.39e-

11)./((power(x,5)).*(exp(1.432./(3500.*x))-1)));

h = ((b-a)/n);

I=0;

I = I + y(a);

for ii = (a+h):h:(b-h)

I = I + 2*y(ii) ;

end

I = I + y(b);

I = I*(h/2);

fprintf('The area under the curve using the formula for

the given y function with boundaries %g and %g

: %0.3f\n',a0,b0,I)

clear x;

clear y;

error1=double((abs(z-I)/z)*100);

error2=double((abs(z-a2)/z)*100);

fprintf('The percentage error between using the formula

and built in integration funtion is :

%0.2f%%\n',error1)

fprintf('The percentage error between using the formula

and built in trapezoidal rule funtion is :

%0.2f%%\n',error2)

x2 =a:h:b;

y2 = ((2.39e-

11)./((power(x2,5)).*exp(1.432./(3500.*x2))));

for i=1:n

fill([x2(i) x2(i+1) x2(i+1) x2(i)],[0 0 y2(i+1)

y2(i)],'g' )

hold on

end

plot(x2,y2,'m--o')

xlabel('Wavelength (cm)')

ylabel('Energy (J)')

title('Graph of Energy against Wavelength')

- Problem Set 8Uploaded byEamon Barkhordarian
- ElectricalUploaded byLalit Attri Bhartiya
- 122 - Documentation Rhinogold AnalyzeUploaded bypaco9800
- ap calculus bc syllabusUploaded byapi-317867476
- ISOPE-P-90-092Uploaded bySpecule
- Integration_by_parts.pdfUploaded byZhy Shone
- Surface AreaUploaded byMary Belle Peraren Estores
- June 2008 P1Uploaded byDijana123
- Inequalities (seoncadry)Uploaded byIra Zawiyah
- MAT 191Uploaded bykiller0514
- integral.pdfUploaded byJm Neutron
- MathsUploaded byNetaji Gandi
- ISI_M.SUploaded byapi-26401608
- Curriculum Map Math 7+ 16-17Uploaded byst72136
- Cauchys TheoremUploaded byZen Kok
- c4-3Uploaded byVinay Gupta
- matlab part2Uploaded byyrikki
- Gr7 ErrataUploaded byAndrey Kazak
- Geller Geus Productive Errors 2012Uploaded byconic
- bk8_19Uploaded byCh Saqib Nazir
- similarityUploaded byapi-241951122
- Surface AreaUploaded bysherdan
- CNQ#3.pdfUploaded byareeja
- Area and Volume (1)Uploaded byShaira Mae Langala
- 2017 Grade 6 MTAP Elimination RoundUploaded byAnonymous yIlaBBQQ
- 2017 MTAP Grade 10 Cat a SectoralsUploaded byJonas Rhein Pruelo Esguerra
- Integration Modul 4 PDF December 3 2008-1-05 Am 640kUploaded byKaness Mathz
- dsfdsfsdfdUploaded byMohamed Adel
- Pseudo Cod 2Uploaded bySerban Andrei
- Multivariable 07 IntegrationUploaded bysreekantha

- Tensile Test Lab ReportUploaded bycocodave
- Chap01- Intro and Basic ConceptsUploaded byMelvin Shady Pereira
- Flywheel.docxUploaded byMelvin Shady Pereira
- Tutorial01.docUploaded byMelvin Shady Pereira
- 22919957 Tensile Test Lab ReportUploaded byMelvin Shady Pereira
- Chapter 8 - File IOUploaded byMelvin Shady Pereira
- A4_CharpyLab_1996 (1)Uploaded bySyazwan Aizad Abdul Mutalib
- copy-oneUploaded byMelvin Shady Pereira
- 2D Motion Table for StudentsUploaded byMelvin Shady Pereira
- TrussUploaded byMelvin Shady Pereira
- Lab Report TemplateUploaded byMelvin Shady Pereira
- 22919957 Tensile Test Lab ReportUploaded byMelvin Shady Pereira
- ReadMeUploaded byVinosha Sivadev
- Downloaded from www.ETTV.tv .txtUploaded byMelvin Shady Pereira
- AbuUploaded byMelvin Shady Pereira
- List of Common Operators in C++Uploaded byMelvin Shady Pereira
- C++ Operator PrecedenceUploaded byMelvin Shady Pereira
- Chapter 3(b) - Selection (Nested if, Switch)Uploaded byMelvin Shady Pereira
- Chapter 4(c) - Repetition - Do While LoopUploaded byMelvin Shady Pereira
- Chapter 6(b) - Arrays and Pointer (Part 2 - Pointers)Uploaded byMelvin Shady Pereira
- Chapter 5(a)- Function - Declaring Function and Variable ScopeUploaded byMelvin Shady Pereira
- Chapter 5(c)- Function - Returning a Value From a FunctionUploaded byMelvin Shady Pereira
- Chapter 4(b) - Repetition - While LoopUploaded byMelvin Shady Pereira
- Chapter 2(a) - Memory, Addresses and VariableUploaded byMelvin Shady Pereira
- Chapter 2(b)- Data Type and OperatorsUploaded byMelvin Shady Pereira
- Tutorial Chapter 1Uploaded byMelvin Shady Pereira
- Chapter 1(b) -Getting Started With C++Uploaded byMelvin Shady Pereira

- Newton the Method of Fluxions and Infinite Series ( [1736])Uploaded byMarcelo Silvano de Camargo
- alorithm basicsUploaded byankit pandey
- Linear ProgrammingUploaded byKareem Mohd
- Union and IntersectionUploaded byMa Cecilia Angeles Baay
- Math 9C Final Practice 3 With SolutionsUploaded byArthy Sangar
- Image Transform 2Uploaded bynoorhilla
- Amat2012 Abstracts BookUploaded byHayet Slimani
- final-study-material-maths-class-x-2012-2013.docxUploaded bygomathi_nellai
- Few Shell Programming for Computer Science StudentsUploaded byTanay Mondal
- Algebra Extra Credit Worksheet--Rotations and TransformationsUploaded byGambit King
- TohUploaded byveere_arun
- C3-Modulus-functions.pdfUploaded byatul kumar
- 03 BruteForceExhaustiveSearch 3rd EditionUploaded byMuhammad Nur Fateeh
- Multi WayUploaded byNilson Bispo
- (Lecture Notes in Logic) Katrin Tent, Martin Ziegler-A Course in Model Theory-Cambridge University Press (2012) (1).pdfUploaded byEnrique Zavala Castillo
- LE1 Summary Math 55Uploaded byggwp21
- 2Uploaded byBob Azadi
- 9A05302 Advanced Data StructuresUploaded bysivabharathamurthy
- Scott Flansburg - Mega Math - Workbook - Turn on the Human Calculator in YouUploaded byKarthik T Narayan
- Learning From Data (11)Uploaded byNJSchandler
- Literature regarding Automatic Timetable GenerationUploaded byVikrantMane
- data structure & algorithms - pattern matchingUploaded byMrIthenG
- Signal Processing Continuous and DiscreteUploaded byalexandraanastasia
- IMO2017SLUploaded byAbhishek Yadav
- String Matching Problem.pptUploaded bySiva Agora Karthikeyan
- 1 Intro Surface IntsUploaded byHjgfd Itfrityf
- 57435441-SAT-II-MathUploaded byZaruhi Zhamharyan
- 2010 Managing & Mining Graph Data.pdfUploaded bySafi Ahmed
- The Ford-Fulkerson MethodUploaded byArdhiansyah Baskara
- Chapter 3 Pair of Linear Equations in Two VariablesUploaded byKuldeep Mishra