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

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?
 
There are two things I don't understand about this problem. First, when finding the nth root of a number, there should in theory be n solutions. However, the formula produces n+1 roots. Here is how. The first root is simply ##\left(r\right)^{\left(\frac{1}{n}\right)}##. Then you multiply this first root by n additional expressions given by the formula, as you go through k=0,1,...n-1. So you end up with n+1 roots, which cannot be correct. Let me illustrate what I mean. For this...
Back
Top