How to graph an expression involving sum?



I have a solution of a differential equation in terms of some fourier
series. I would like to graph one of the spatially varying coefficients,
so I tried something like:

draw2d(explicit(subst(avals,coefseries),z,0,1));

Where coefseries is something like a[0] + sum(a[i]*cos(...),i,1,17) and
avals are the values for a[0]...a[17] in a list of the form
[a[0]=...,a[1]=..., ...]

but what the subst gives me is still in the form 1.234 +
sum(a[i]*cos(...)...), that is, subst substituted the constant
coefficient but of course not the individual coefficients in the sum
(since they only appear as a[i]).

What's the right way to go about graphing something like this?

Thanks,
Dan