transfer function command to use in 'Matlab function block'
古いコメントを表示
Hello friends,
I desinged IIR Bandpass filter using R,L,C values and usinf 'tf' command I got the transfer function of that filter. similarly I converted it from continuous to discrete 'c2d'.
Now I need to use this .m file for code generation. Is it possilbe to use direct m-file? If I use matlab-function block which is used to generate c/c++ code. This bloock is not accepting 'tf' command for code generation.
and similarly 'grpdelay' command is also not accepted by this block. Can anyone help me with this problem please.
function filter_tf
Ts = 1e-7 ;
Fs = 1/Ts ;
% Bandpass filter
F1 = 190000 ;
F2 = 4000000 ;
F = [F1, F2] ;
W1 = 2*pi*F1 ;
W2 = 2*pi*F2 ;
BF = (W2 - W1) ;
W0 = sqrt(W1 * W2) ;
W12 = 1/(W0 * W0) ;
Q = W0 / BF ;
Fr = sqrt(F1 * F2) ;
R = 100 ;
C = (1/(BF*R)) ;
L = (W12 / C) ;
N = 1/(R * C) ;
D1 = 1/(R * C) ;
D2 = 1/(L *C) ;
Fc = 1/(2*3.14*sqrt(L * C)) ;
RC = R * C ;
LC = L * C ;
RL = R / L ;
Wc = 1/(2 * pi * Fc);
% Implementing Continious transfer function
F1 = tf([N 0],[1 D1 D2]) ;
continnious_transfer_function_bandpass = tf(F1)
% % Continious to discrete using Bilinear Z-Transformation
discrete_transfer_function_bandpass = c2d(continnious_transfer_function_bandpass,Bandpass.Ts,'tustin')
thanks in advance
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Texas Instruments C2000 Processors についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

