how do i calculate the partial sum of a fourier series?
조회 수: 4 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Jyotsna Talluri
2020년 5월 18일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!