Simple Frequency Response Function

5 visualizzazioni (ultimi 30 giorni)
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!

Risposta accettata

Jonathan Medina
Jonathan Medina il 22 Feb 2020
Modificato: Jonathan Medina il 22 Feb 2020
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

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by