Plotting the Fourier series in Matlab

Click For Summary
SUMMARY

The discussion focuses on plotting the Fourier series of a piecewise function in MATLAB. The Fourier series coefficients are defined, with specific values for a0, ak, and bk. Participants outline a MATLAB program that generates three figures: the original function, subplots for the Fourier series approximations at different terms, and a superimposed plot of both the function and its Fourier series approximations. Key MATLAB functions and plotting techniques are emphasized for effective visualization.

PREREQUISITES
  • Understanding of Fourier series and their coefficients
  • Familiarity with MATLAB programming and plotting functions
  • Knowledge of piecewise functions and their graphical representation
  • Experience with MATLAB's subplot and legend functionalities
NEXT STEPS
  • Learn how to calculate Fourier series coefficients in MATLAB
  • Explore MATLAB's plotting functions, including plot and subplot
  • Study the use of legends and titles in MATLAB plots for better visualization
  • Investigate the impact of increasing the number of terms in Fourier series approximations
USEFUL FOR

Students and educators in mathematics or engineering, MATLAB users interested in signal processing, and anyone looking to visualize Fourier series and piecewise functions effectively.

miss_t
Messages
1
Reaction score
0
I am very confused on how to start this problem, would highly appreciate some help!
Consider the function
f(x)=   0, -1≤x≤0
2x, 0≤x≤1.

The Fourier series coefficients for this function are given by [a][/0]=0.5, and for  k=1, 2, 3,...
 
[a][/k]=(2((-1)^k-1))/(k∏)^2 and [/k]=(2(-1)^(k+1))/k∏
.
Write a Matlab program to obtain three Figures:
(a) Figure 1 must contain a plot of the function f(x).
(b) Figure 2 must contain four subplots, arranged in a 2 X 2 grid. Each subplot must contain a plot of ,[g][/N](x)
one for each value of N= 1, 3, 7, 20.
(c) Figure 3 must contain a plot of f(x), and ,[g][/N](x) for N=  1, 3, 7, 20, all superimposed. Use a suitable
legend to identify the five plots in the figure.
In each case, make sure you use a suitable title, and labels for the axes. Pick at least 100 points from the interval
[-1, 10] so that you get a smooth looking plot.
 
Physics news on Phys.org
Hey miss_t and welcome to the forums.

This looks like a class problem, so I'll ask you what information have you been given in terms of the MATLAB functions.

Have you been given a reference guide by your tutors/lecturers? How much programming experience do you have whether its using C or something like MATLAB/Maple/Mathematica or some other mathematics computer package?

Basically what happens commonly is that the package creators provide documentation and help on all the commands that you can use as well as the parameters and then you just read the help file and do what you need to do, but if you haven't had any kind of programming experience this may seem daunting.
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K