1 Attachment(s)

Mapping arrays to use negative indexes

For an assignement in my Continuous Time Signals class, we were asked to calculate the fourier series of a given x(t). The problem I'm running into is we are asked to calculate the Dn in my m-file from -10 to 10 (course Matlab cannot handle negative indices and 0 since the numerical values of Dn are stored in an array). Is there any kind of solution that I could use to get aorund this to make it calculate from -10 to 0?

Thank you a lot.

Attached is my m-file with the necessary functions. The main m-file is called Prob2. Particularly the end where plotting of Dn is where I'm mainly talking about.