Frequency response function In matlab
14 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Walter Roberson
2018 年 2 月 20 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Digital Filter Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!