MATLAB Answers

Fourier cosine series of a vector

8 views (last 30 days)
masoud meskin
masoud meskin on 27 Feb 2020
Commented: masoud meskin on 3 Mar 2020
Hi guys,
I have a vector f1 and i need to find the coefficients of the cosine series of f1 for at least 8 harmonics. Any help would be highly appreciated.
Thank you


Sign in to comment.

Answers (1)

Charan Jadigam
Charan Jadigam on 2 Mar 2020
Fourier Cosine Coefficients of the vector can be found using ‘Fit’ function. You can do so by,
>> fit(t1',f1','fourier8')
You can know more about the function and it’s parameters here.

  1 Comment

masoud meskin
masoud meskin on 3 Mar 2020
Hi Charan,
I knew about the "Fit" command and the application. But it gives combination of Sine and Cosine.
Is it going to be different from when i take the fourie cosine directly by codes like this (I found it on the internet):
syms x k n
f = x
a = @(k) 2*int(x*cos(k*pi*x),x,0,1);
fourier_cosine_partial_sum = @(x,n) a(0)/2 + ...
Sorry if my question is stupid.
Thank you

Sign in to comment.

Translated by