How would i synthesize a signal given this?

1 view (last 30 days)
Chelsi
Chelsi on 16 Sep 2014
Commented: Image Analyst on 16 Sep 2014
function [xx, tt] = fourierSyn(ak, w0 , dur, fs)
% -----------------------------------------------------
% fourierSyn.m
% -----------------------------------------------------
% fourierSyn synthesizes a signal using Fourier series
% -----------------------------------------------------
% Syntax: [xx, tt] = fourierSyn(ak, w0 , dur, fs)
% ak = vector of 2N – 1 Fourier coefficients, N >= 1
% ak(1) is coefficient -N, ak(2N-1) is coefficient N
% ak(N) is coefficient 0 (DC)
% w0 = fundamental frequency in rad/sec
% dur = time duration of signal
% fs = sampling frequency (OPTIONAL: default is 10*fmax)
% xx = (vector of) samples of the synthesized signal
% tt = vector of time instants for t = 0 to t = dur
% -----------------------------------------------------
if( nargin < 4) % default fs
maxfreq = (length(ak) - 1)/2 * w0/(2*pi);
if maxfreq > 1
fs = 10*maxfreq;
else
fs = 10;
end
end
  1 Comment
Image Analyst
Image Analyst on 16 Sep 2014
Where is the rest of the code? xx and tt are not even created or returned. Is this a homework assignment where you were given partial code and expected to finish it?

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!