Question: Writing a (Matlab) function to find fourier coefficients. t is the time interval, 0:0.001:6*pi, x is the waveform function (cos(t) for example), N is the
Writing a (Matlab) function to find fourier coefficients. t is the time interval, 0:0.001:6*pi, x is the waveform function (cos(t) for example), N is the # of terms desired in the forier series, and T is the waveforms fundamentaI period.
Need help fixing THIS code to make it work for the given parameters and outputs, using the two "for loops. Thanks

1 function average a k,b k] fourier (t, x, T, Y) dt 0.01; for k 1 Y for q 1 :T a (k) a (k)+(2/T)* (x (q)) cos (k pitt (q))*dt; b (k) b (k) (2/T)* (x(q)) sin (k pit t (q) )*dt; average mean (x) 10 end 12 13 14 end 16 average double (mean (x)); a k-double (a (k)); 18 b k double (b (k)); 21 end
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
