What is the Fourier Series Coefficient of F=exp(sin(x))?
10 views (last 30 days)
Show older comments
syms x
T=2;
w0=2*pi/T;
f=exp(sin(x));
a0_sym=1/T*int(f,x,0,T);
a0_sym=double(a0_sym);
for n=1:3
a_sym(n)=2/T*int(f*cos(n*w0*x),x,0,T);
b_sym (n)=2/T*int(f*sin(n*w0*x),x,0,T);
a(n)=double(a_sym(n));
b(n)=double(b_sym(n));
end
s = a0_sym + sum(a.*cos((1:3).*w0.*x),2) + sum(b.*sin((1:3) .* w0.*x),2)
x_num = (-10:0.01:10).';
s_num = double(subs(s,x,x_num));
plot(x_num,s_num)
This is what I did but I'm not getting the desired result...
Please help
6 Comments
Torsten
on 20 Oct 2022
I have no experience with FFT, but
should be the correct tool for this task.
Answers (1)
Bjorn Gustavsson
on 21 Oct 2022
Edited: Bjorn Gustavsson
on 21 Oct 2022
Might I be so bold as to suggest (physicist writing about calculus here...) that this task ought to have some clever analytical solution method that is easier to do by hand than with help of computer. If you write the exponential as its series expansion:
For the first few terms we can easily rewrite (sin(t))^n into simple sin(n*t) and cos(n*t) terms, and there are trogonometric power-formulas: Trigonometric Power Formulas. If you use those you will get some gnarly expressions for the higher (or arbitrary) powers of (sin t)^k. If you plug those expression into matlab's symbolic tools you might get it to clean them up such that you can recognize the coefficients before the sin(k*2*pi*t) and cos(k*2*pi*t) terms. Those should be your Fourier-coefficients.
HTH
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!