Generate a pulse waveform using the fourier series expansion.

2 views (last 30 days)
Hello, this is another MATLAB question that I am not sure how to begin. Could someone help with this?... thanks in advance.

Answers (1)

Gautam
Gautam on 7 Feb 2025
Hello Kevin,
In this problem too, you are given the coefficient of the sine term of the Fourier series expansion for the function g(x). All you have to do is take the sum of the first N sine terns multiplied by their coefficients.
Here's the code that does it for the first 16 terms. You can modify the code according to you requirement and format the output using the fommands mentioned in the problem statement.
N = 16;
x = linspace(0,2,80);
F=0;
a=1/8;
bn = @(n) (4/pi)*(1/n)*sin(n*pi/4)*sin(n*pi*a);
for n = 1:N
F = F + bn(n)*sin(n*pi*x);
end
plot(x,F)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!