how do i calculate the partial sum of a fourier series?
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have the following function:
f(x)=1/2*(cos(x)+|cos(x)|), x ∈ [-π,π]
how do I calculate the partial sum using matlab code?
0 Commenti
Risposte (1)
Jyotsna Talluri
il 18 Mag 2020
There is not direct built-in function yet to do that .You can do that by your own code.Try the script below with your function
syms k ;
evalin(symengine,'assume(k,Type::Integer)');
syms x L n;
a = @(f,x,k,L) int(f*cos(k*sym('pi')*x/L)/L,x,-L,L);
b = @(f,x,k,L) int(f*sin(k*sym('pi')*x/L)/L,x,-L,L);
fs = @(f,x,n,L) a(f,x,0,L)/2 + ...
symsum(a(f,x,k,L)*cos(k*pi*x/L) + b(f,x,k,L)*sin(k*pi*x/L),k,1,n);
simplifiedfs = @(f,x,n,L) pretty(simplify(fs(f,x,n,L)));
Here f denotes your function ,f= cos(x)+abs(cos(x)); L denotes limits L = pi and x is the variable by which the function is varying.
fs(f,x,n,pi) calculates the partial sum of Fourier series of function f from K =1 to n
0 Commenti
Vedere anche
Categorie
Scopri di più su Fourier Analysis and Filtering 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!