# Fourier Series Integration in terms of Pi

12 visualizzazioni (ultimi 30 giorni)
Bob Gill il 17 Apr 2023
Modificato: VBBV il 15 Lug 2024 alle 21:28
Hello,
The following code is just to check my integration of a fourier series transform, but the output doesn't seem to be right for bn. It displays a large number at the end of the bn output.
syms t
syms n 'integer'
an = (1/pi)*(int(-1*cos(n*pi*t/pi),-pi,-pi/2)+int(0*cos(n*pi*t/pi), -pi/2, pi/2)+int(1*cos(n*pi*t/pi), pi/2, pi))
bn = (1/pi)*(int(-1*sin(n*pi*t/pi),-pi,-pi/2)+int(0*sin(n*pi*t/pi), -pi/2, pi/2)+int(1*sin(n*pi*t/pi), pi/2, pi))
pretty(an)
pretty(bn)
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposte (1)

VBBV il 17 Apr 2023
Modificato: VBBV il 15 Lug 2024 alle 21:28
Hi @Bob Gill, the value of bn can be computed as follows
syms t n 'integer'
an = (1/pi)*(int(-1*cos(n*pi*t/pi),-pi,-pi/2)+int(0*cos(n*pi*t/pi), -pi/2, pi/2)+int(-1*cos(n*pi*t/pi), pi/2, pi))
an =
bn = (1/pi)*(int(-1*sin(n*pi*t/pi),-pi,-pi/2)+int(0*sin(n*pi*t/pi), -pi/2, pi/2)+int(-1*sin(n*pi*t/pi), pi/2, pi))
bn =
0
vpa(an,2)
ans =
vpa(bn,2)
ans =
0.0
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
VBBV il 17 Apr 2023
Modificato: VBBV il 17 Apr 2023
Use vpa to ccompute the bn value. You can also consider the vpaintegral function to compute the values for an and bn

Accedi per commentare.

### Categorie

Scopri di più su Calculus in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by