Fourier Series: A_0=0, a_n=0, b_n=2/(n∏); Period p=2

In summary, the conversation was about calculating Fourier coefficients and generating Fourier terms using MATLAB. The original function was y=sin(x) with a period of p=pi. The attempt at solving the problem was not deemed good enough, but the poster showed effort by declaring variables and using loops to calculate the coefficients and generate the Fourier terms. The need for further improvement and understanding of MATLAB was mentioned.
  • #1
tonytp70
3
0

Homework Statement



Fourier coefficients: A_0=0, a_n=0, b_n=2/(n∏) ; period p=2

Homework Equations



Fourier series


The Attempt at a Solution



Attempt was not good enough!
 
Physics news on Phys.org
  • #2
Welcome to PF;
Were you supposed to write a MATLAB script to calculate a number of Fourier coefficients?
Please show us the attempt anyway - along with your reasoning.
What was it about your attempt that was "not good enough"?
 
  • #3
Alas, the poster's attempt at posting a question wasn't good enough.
 
  • #4
jokes?

I get it; that's a joke right?

Very good streamking!

One must not lose their sense of humor, even in the mist of battle, very clever, but not good enough!


Alas,



%% I_A
% BEGIN SOME FUNCTION AND VARIABLE DECLARATIONS
syms x;
length_of_k = 25; % Number of coefficients to calculate
p = pi; % Function period
y = sin(x); % Function
x_test = -p : 1/25 : 2*p; % Original x values
y_test = sin(x_test); % Original f(x)
% END SOME FUNCTION

% BEGIN COMPUTING FOURIER COEFFICIENTS
% -- BEGIN NOTES --
% Calculate : a_0, a_k, b_k with k > 0
% a_0 = (1/p)*int(f(t), t, 0, p) -- Integral f(t) w.r.t. t from 0 to p
% a_k = (2/p)*int(f(t)*cos((2*pi*k*t)/p), t, 0, p)
% b_k = (2/p)*int(f(t)*sin((2*pi*k*t)/p), t, 0, p)
% -- END NOTES --

a_0 = (1/p)*int(y, x, 0, p); % Calculate as priming reed
a_coeff = []; % Declaring null array
b_coeff = []; % Declaring null array
fprintf('Fourier Coefficient:\ta_0 ==> %0.2f\n', double(a_0))

for k = 1 : length_of_k
a_coeff = [a_coeff, (2/p)*int(x*cos(2*pi*k*x/p), x, 0, p)];
b_coeff = [b_coeff, (2/p)*int(x*sin(2*pi*k*x/p), x, 0, p)];
fprintf('Fourier Coefficient:\t');
fprintf('a_%1.0f ==> %0.3f\t\t', k, double(a_coeff(k)));
fprintf('b_%1.0f ==> %0.3f\n', k, double(b_coeff(k)));
end
% END COMPUTING FOURIER COEFFICIENTS

% BEGIN GENERATING FOURIER TERMS
fs_x = [];
fs_a0_calc = (a_0/2);
for i = 1 : length(x_test)
a_calc = 0;
b_calc = 0;
for k = 1 : length_of_k
a_calc = a_calc + a_coeff(k)*cos(k*x_test(i));
b_calc = b_calc + b_coeff(k)*sin(k*x_test(i));
end
fs_x = [fs_x, fs_a0_calc + a_calc + b_calc];
end
% END GENERATING FOURIER TERMS

% BEGIN PLOTS
plot(x_test, y_test, 'b', x_test, fs_x, 'r'); % Plot the original function
grid on; % Turn on grid
% END PLOTS

% BEGIN DEBUGGING CODE
fprintf('Max of f(x) = %0.4f\n', max(y_test));
fprintf('Min ox f(x) = %0.4f\n', min(y_test));
fprintf('Max of FS[x] = %0.4f\n', max(double(fs_x)));
fprintf('Min of FS[x] = %0.4f\n', min(double(fs_x)));
% END DEBUGGING CODE
 
  • #5
You missed out the reasoning and why it was not "good enough".
 
  • #6
I will know more about that as I become better with matlab. There were requirements that I was not able to meet at this point and time, but I will become better and get to a point where I am comfortable with matlab. It will take time, but I will learn!
 

FAQ: Fourier Series: A_0=0, a_n=0, b_n=2/(n∏); Period p=2

What is a Fourier series?

A Fourier series is a mathematical series that represents a periodic function as a sum of sine and cosine functions. It is named after the mathematician Joseph Fourier, who first used this method to solve heat transfer problems in the 19th century.

What does "A_0=0, a_n=0, b_n=2/(n∏); Period p=2" mean?

This notation refers to the coefficients of the Fourier series for a specific function. In this case, A_0=0 means that there is no constant term in the series, a_n=0 means that there are no cosine terms, and b_n=2/(n∏) means that the coefficient for each sine term is 2/(n∏). The period, p=2, indicates that the function repeats every 2 units.

Why is A_0 set to 0 in this Fourier series?

In some cases, the constant term A_0 may be non-zero, but in this particular case, it is set to 0 because the function being represented is an odd function, meaning it has a symmetry about the origin and does not have a constant term in its Fourier series.

How is this Fourier series used in science?

Fourier series are used in many areas of science, including physics, engineering, and mathematics, to represent periodic functions and to analyze and solve problems involving periodic phenomena. They have applications in areas such as signal processing, heat transfer, and quantum mechanics.

What is the significance of the coefficient b_n=2/(n∏) in this Fourier series?

The coefficient b_n=2/(n∏) represents the amplitude of each sine term in the Fourier series. As the value of n increases, the amplitude decreases, resulting in a smoother representation of the function. This coefficient is important in determining the accuracy of the Fourier series approximation of the original function.

Similar threads

Replies
6
Views
991
Replies
16
Views
1K
Replies
1
Views
908
Replies
4
Views
761
Replies
8
Views
2K
Replies
2
Views
1K
Back
Top