Fourier Coefficient of the given Function

1 visualizzazione (ultimi 30 giorni)
Tariq Malik
Tariq Malik il 9 Mag 2018
Modificato: Tariq Malik il 9 Mag 2018
##(Given Function) f(x)=1/2(sin x + sin x) xє[-π , π]
##I obtain the bellow Fourier Coefficient of the given function .
##f(x) = 1/π Σ 2((cos(nπ)-1)/nπ)
##Now I am using the below Matlab code But I think the Fourier Coefficient or the MatLab code is wrong . Please someone check.
##MatLab code
x=linspace(-pi,pi);
f=2*((cos(x)-1)/pi);
g=abs(x);
N=10;
for i=2:N
f=f+(2*((cos(i*x)-1)/pi*(i));
end
c=f+pi/2;
figure;
plot(x,c,'r',x,g,'b')

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by