Truncated Fourier series analysis in Matlab

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 9K views
d2009
Messages
1
Reaction score
0
a) Write a Matlab function, which accepts the following inputs

-a finite set of Fourier series coefficients

-the fundamental period T of the signal to be reconstructed

-a vector t representing the times for which the signal will be reconstructed.

This function should produce an output x[t][/n]( should be a vector x with length equal to the length of t containing values of xn at the times indicated by t.

this is the code i have come up with so far.

function fourier1=f(a,T,t)
fourier1=zeros(length(a),1);
for n=1:length(a)
fourier1(n)=(a(n)*exp((i*(2*pi/T)*n*t)));
end;
 
Last edited:
Physics news on Phys.org