MATLAB: Simple Frequency Response Function

dspfir systemfrequency responsefunctionsignals

I am trying to make a function that outputs the following frequency response of an FIR system:
where b is a vector of filter coefficients, w is a vector of angular frequencies, and output H is a complex-valued frequency response. I think I need a for loop to account for the summation, but I am not sure how to go about this (I am a MATLAB novice).
Thanks!

Best Answer

I think I figured it out. Any comments/suggestions would be appreciated.
function H = FreqResponse(b,w)
% This function inputs a vector b of filter coefficients and a vector w of
% angular frequencies and outputs a complex-valued frequency response H.
H = zeros(length(b),1);
for k = 1:length(b) %index for filter coeff's
H = H + b(k) * exp(-1j*w*k); %given frequency response
end
end
Related Question