source: MML/trunk/machine/SOLEIL/common/toolbox/SymbolicPolynomials/SymbolicPolynomials/@sympoly/double.m @ 4

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: 448 bytes
Line 
1function dbl=double(sp)
2% sympoly/double: convert a constant polynom array (or scalar) to a double
3% usage: dbl=double(sp);
4%
5% arguments:
6%  sp - sympoly object - scalar or a sympoly array - must all be constants
7%
8%  dbl - double array of the same size as sp
9
10dbl=zeros(size(sp));
11for i=1:numel(sp)
12  spi = sp(i);
13 
14  E = spi.Exponent;
15  if any(E(:)~=0)
16    error 'This sympoly is not a constant'
17  end
18 
19  dbl(i) = sum(spi.Coefficient);
20end
21
Note: See TracBrowser for help on using the repository browser.