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

Click For Summary
To convert the piecewise function f(x) into MATLAB code for a Fourier series with n=500, users need to define the function in MATLAB and utilize the Fourier series formula. The function is defined differently across three intervals: x for 0 < x < pi/2, x/2 for pi/2 < x < pi, and pi - (x/2) for pi < x < 2*pi. The discussion emphasizes the need to ensure the periodicity of the function, assuming a period of pi. Users are encouraged to share their MATLAB code snippets and graphical outputs to assist others in achieving the desired Fourier series representation.
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?
 
Question: A clock's minute hand has length 4 and its hour hand has length 3. What is the distance between the tips at the moment when it is increasing most rapidly?(Putnam Exam Question) Answer: Making assumption that both the hands moves at constant angular velocities, the answer is ## \sqrt{7} .## But don't you think this assumption is somewhat doubtful and wrong?

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 16 ·
Replies
16
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 7 ·
Replies
7
Views
2K