Hi I posted a question earlier, but it got few responses. I need help in this because I am using MATLAB for the first time.
Can someone tell me how I can get the zeros and poles of a digital bandpass filter I created from an analog lowpass prototype? I did de-normalization of the poles and zeros and created a function for bilinear transform.
Then I implemented spectral transform from the digital poles, zeros and gain. I have two problems:
1. When I plot this against omega, I get it like a bandstop filter (if the range of omega is 0 to pi). Should I take negative values?
2. My function takes the input arguments as digital zeros, digital poles, digital gain, desired upper and lower cut-off for bandpass and the lower cut-off of the lowpass and finally the frequency variable (7 inputs). And the output argument is the magnitude of the bandpass. I have defined it as follows:
function [ H_band ] = trand_bandpass(Zd,Pd,Kd,wc1,wc2,wc,omega)
Product_Z = 1;
Product_P = 1;
Zeros = numel(Zd);
Poles = numel(Pd);
z_tilda = exp(1)^(1i*omega);
alpha = (cos((wc1+wc2)/2))/(cos((wc2-wc1)/2));
beta = (cot((wc2-wc1)/2))*(tan(wc/2));
A = (2*alpha*beta)/(beta + 1);
B = (beta - 1)/(beta + 1);
up = ((z_tilda)^(-2))-(A*((z_tilda)^(-1)))+B;
down = (B*((z_tilda)^(-2)))-(A*((z_tilda)^(-1)))+1;
ze = up/down;
for r = 1:Zeros
Product_Z = Product_Z*(ze -Zd(r));
end
for r = 1:Poles
Product_P = Product_P*(ze - Pd(r));
end
H_b = Kd*(Product_Z)*((1+ze)^(Poles-Zeros))/(Product_P);
H_band = abs(H_b);
end
Can someone help me return the zeros, poles and gain of this filter?
Can someone tell me how I can get the zeros and poles of a digital bandpass filter I created from an analog lowpass prototype? I did de-normalization of the poles and zeros and created a function for bilinear transform.
Then I implemented spectral transform from the digital poles, zeros and gain. I have two problems:
1. When I plot this against omega, I get it like a bandstop filter (if the range of omega is 0 to pi). Should I take negative values?
2. My function takes the input arguments as digital zeros, digital poles, digital gain, desired upper and lower cut-off for bandpass and the lower cut-off of the lowpass and finally the frequency variable (7 inputs). And the output argument is the magnitude of the bandpass. I have defined it as follows:
function [ H_band ] = trand_bandpass(Zd,Pd,Kd,wc1,wc2,wc,omega)
Product_Z = 1;
Product_P = 1;
Zeros = numel(Zd);
Poles = numel(Pd);
z_tilda = exp(1)^(1i*omega);
alpha = (cos((wc1+wc2)/2))/(cos((wc2-wc1)/2));
beta = (cot((wc2-wc1)/2))*(tan(wc/2));
A = (2*alpha*beta)/(beta + 1);
B = (beta - 1)/(beta + 1);
up = ((z_tilda)^(-2))-(A*((z_tilda)^(-1)))+B;
down = (B*((z_tilda)^(-2)))-(A*((z_tilda)^(-1)))+1;
ze = up/down;
for r = 1:Zeros
Product_Z = Product_Z*(ze -Zd(r));
end
for r = 1:Poles
Product_P = Product_P*(ze - Pd(r));
end
H_b = Kd*(Product_Z)*((1+ze)^(Poles-Zeros))/(Product_P);
H_band = abs(H_b);
end
Can someone help me return the zeros, poles and gain of this filter?