Last change
on this file since 4 was
4,
checked in by zhangj, 10 years ago
|
Initial import--MML version from SOLEIL@2013
|
File size:
767 bytes
|
Line | |
---|
1 | function pint = defint(sp,intvar,interval) |
---|
2 | % sympoly/int: definite integral of a sympoly |
---|
3 | % usage: pint = defint(sp,intvar,interval); |
---|
4 | % |
---|
5 | % arguments: (input) |
---|
6 | % sp - scalar sympoly object |
---|
7 | % |
---|
8 | % intvar - character - name of variable to integrate over |
---|
9 | % |
---|
10 | % interval - numeric vector - length 2 - limits of integration |
---|
11 | % |
---|
12 | % arguments: (output) |
---|
13 | % pint - scalar sympoly object - definite integral of the polynomial |
---|
14 | |
---|
15 | % intervals needs to be supplied, and it must |
---|
16 | % be of length 2 |
---|
17 | if (nargin~=3) || length(interval)~=2 |
---|
18 | error 'interval needs to be a vector of length 2' |
---|
19 | end |
---|
20 | |
---|
21 | % indefinite integral |
---|
22 | pint = int(sp,intvar); |
---|
23 | |
---|
24 | % substitute at the end points of the interval, then subtract |
---|
25 | pint = subs(pint,intvar,interval(2)) - ... |
---|
26 | subs(pint,intvar,interval(1)); |
---|
27 | |
---|
28 | |
---|
29 | |
---|
Note: See
TracBrowser
for help on using the repository browser.