Converting f(x) to MATLAB Code for Fourier Series with n=500

Join the discussion
Registration is free. Start your own thread to ask a follow-up.
2 replies · 20K views
zuelhuzz
Messages
1
Reaction score
0
The problem are as below :-

f(x) = {
x, for 0 < x < pi/2;
x/2, for pi/2 < x < pi;
pi-(x/2), for pi < x < 2*pi;

how do I convert it to Matlab code and produce a graph of Fourier series with n=500?

I have done analytically by hand for n=2, but the question ask to produce n=500, can anybody help?
 
Physics news on Phys.org
I don't see any reason why that can't be integrated, "by hand", for any n. It doesn't look like the general n would be any harder than n= 1 or 2. Are we to assume this is periodic with period pi?