Matlab Integral - PowerPoint PPT Presentation

About This Presentation
Title:

Matlab Integral

Description:

Title: Slide 1 Last modified by: etemadi Created Date: 10/11/2006 2:04:50 AM Document presentation format: On-screen Show Company: University at Buffalo – PowerPoint PPT presentation

Number of Views:24
Avg rating:3.0/5.0
Slides: 8
Provided by: engBuffa
Category:
Tags: integral | matlab

less

Transcript and Presenter's Notes

Title: Matlab Integral


1
Matlab Integral
TRAPZ(x,y) QUAD(FH,A,B) DBLQUAD(FH,XMIN,XMAX,YMI
N,YMAX) TRIPLEQUAD(FH,XMIN,XMAX,YMIN,YMAX,ZMIN,ZM
AX)
Creating a function handle, FH, from a function,
f 1- inline object FHinline(f) 2-
function handle Write a m_file with the name
filename.m in the following
format function zfilename(x,y) zf(x,y)
FH_at_filename
2
Trapz(x,y) cumtrapz(x,y)
xlinspace(-1,2,100) yhumps(x) format
long Areatrapz(x,y) plot(x,y) grid
on xlabel(x) ylabel(humps(x)) title(integral
of humps) zcumtrapz(x,y) hold
on plot(x,z) hold off
Area 26.34473119524596
3
QUAD(FH,A,B)
yinline('1./(x.3-2x-5)') Q quad(y,0,2)
test2a.m file
function ytest2a(x) y1./(x.3-2x-5)
Answer y Inline function y(x)
1./(x.3-2x-5) Q -0.4605
quad(_at_test2a,0,2) ans -0.4605
4
DBLQUAD(FH,XMIN,XMAX,YMIN,YMAX)
Evaluates the double integral of f(X,Y) over the
rectangle XMIN lt X lt XMAX, YMIN lt Y lt YMAX.
f can be an inline object or a function handle.
Q dblquad(inline('ysin(x)xcos(y)')
, pi, 2pi, 0, pi) or Q
dblquad(_at_integrnd, pi, 2pi, 0, pi)
where integrnd.m is an M-file
function z integrnd(x, y) z
ysin(x)xcos(y)
Answer
Q -9.86960437725457
5
TRIPLEQUAD(FH,XMIN,XMAX,YMIN,YMAX,ZMIN,ZMAX)
evaluates the triple integral of FUN(X,Y,Z) over
the three dimensional rectangular region XMIN lt
X lt XMAX, YMIN lt Y lt YMAX, ZMIN lt Z lt ZMAX.
Q triplequad(inline('ysin(x)zcos(x)'), 0,
pi, 0, 1, -1, 1)
Answer
Q 1.99999999436264
6
Line Integral
Surface Integral
Volume Integral
7
Line Integral
See Solution
Q quad(inline('-18.sin(phi).cos(phi)'),(pi/2),
pi) Q 8.99999998379294
Write a Comment
User Comments (0)
About PowerShow.com