MATLAB Plotting the Fourier series in Matlab

AI Thread Summary
The discussion revolves around plotting a Fourier series in MATLAB for a specified piecewise function. Users express confusion about starting the problem and seek guidance on MATLAB programming. The Fourier series coefficients are provided, and the task involves creating three specific figures: the function plot, subplots for different values of N, and a superimposed plot of the function and its Fourier approximations. Participants emphasize the importance of consulting MATLAB documentation for commands and parameters, especially for those with limited programming experience. Overall, the thread highlights the challenges of applying theoretical concepts in practical programming scenarios.
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
Views
2K
Replies
1
Views
2K
Replies
10
Views
3K
Replies
2
Views
2K
Replies
1
Views
3K
Replies
2
Views
3K
Back
Top