chebfun/chebfun — pull request #1328 by gradywright (2014-12-08 23:37:00+00:00)
Title: Fix for trigcoeffs bug when even number coefficients requested

The `trigtech/trigcoeffs` method is not returning the correct coefficients when an even number is requested. For example,
```
>> f = chebfun('1 + cos(pi*x)','trig');
>> trigcoeffs(f,2)
ans =
1.0000 + 0.0000i
0.5000 - 0.0000i
```
This also resulted in incorrect results when using the `trunc` flag:
```
>> f = chebfun('1 + cos(pi*x)','trig','trunc',2)
f =
chebfun column (1 smooth piece)
interval length endpoint values trig
[ -1, 1] 2 -0.5 -0.5
Epslevel = 1.480297e-15. Vscale = 1.500000e+00.
```
Note the end point values indicate the result is off.

This pull request fixes this bug and includes tests for even number trig coefficient requests.