Frequency response function In matlab
13 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Can someone help me with this matlab frequency response problem.
This is what I have so far, but code doesnt work.
function [H] = freqresp(b, a, w)
a(1) = 1;
numer(0) = 0;
denom(1) = 0;
for k=1:length(b)
numer(k) = numer(k-1) + b(k) * exp(i*w*k);
end
for m=2:length(a)
denom(m) = denom(m-1) + a(m)*exp(i*w*k);
end
H = numer/denom;
0 Commenti
Risposte (1)
Walter Roberson
il 20 Feb 2018
You have
numer(0) = 0;
In MATLAB, indexing can never start from 0. You need
numer(1) = 0;
for k=1:length(b)
numer(k+1) = numer(k) + b(k) * exp(i*w*k);
end
for m=1:length(a)
denom(m+1) = denom(m) + a(k)*exp(i*w*k);
end
But after that you have a problem. You could try
H = numer ./ denom
but if length(a) and length(b) are not the same, you have a problem.
0 Commenti
Vedere anche
Categorie
Scopri di più su Digital Filter Analysis in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!