Image

As a C programming newbie (all I've ever programmed in is Matlab), I have no idea what I'm doing. How would one code to find the sum for

[1/(2i-1)^2]*cos[((2i-1)*Pi*t)/3]

for all i from 1 to an integer n?

I was thinking of making a for loop to calculate all the values as value(i) into a vector value, then sum(value), but I don't know if this is even possible or how to code it. Please help!

Oh, and if it's relevant, I'm using Microsoft Visual Studio, C++
Also I have already done #define Pi 3.1415826
And finally, t is a variable scanned from an input file.

Thanks!
x-posted to Imagecpp