MATLAB Answers

Help with functions and Graphing

1 view (last 30 days)
Trevon Alvarado
Trevon Alvarado on 21 Apr 2020
Edited: Trevon Alvarado on 21 Apr 2020
Hello Im am having issues calculating the sum Av dB. And Graphing this frequency rersponse of my filter. Its suppuse to be a chebyshev filter but, its just flat-lining.
%Gain
N_freq = length(fs);
Av_k = zeros(N_freq,N_Stages);
%Gain
N_freq = length(fs);
Av_k = zeros(N_freq,N_Stages);
N_freq = length(fs)
Av_k = zeros(N_freq,N_Stages);
for kk =1:N_Stages;
[Av_kk] = EE322_TF(fs,G_new,C_new);
Av_k(:,kk)= Av_kk;
end
%Total Gain
Av_k_dB = 20*log(Av_k);
Av_db = sum(abs(Av_k_dB))
figure()
freqz(Av_db,100,fs)
%}
%-----------------------------------------------------------------------
function [Av_kk] = EE322_TF(fs,G_new,C_new);
s=j*2*pi*fs;
G1=G_new(1);
G2=G_new(2);
G3=G_new(3);
C1=C_new(1);
C2=C_new(2);
A0=-G1*G3;
B2= C1*C2;
B1=(G1+G2+G3)*C2;
B0=(G2*G3);
[Av_kk]= (A0)/(B2.*s^2+B1.*s + B0);
end

Answers (0)

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by