Transfer function to filter signal Simulink to Matlab
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello Everyone,
I have extracted this small part of my simulink model: ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1229622/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1229622/image.jpeg)
I have been trying to realize this in Matlab code without success. First I used the filter option but I realized that A,B do not correspond to numerator and denominator of the transfer function. Then I have tried to use the tf comand to make a transfer function but i do not know how to feed an array of discrete data to it.
I know it is probably trivial but help is greatly appreciated.
0 commentaires
Réponse acceptée
Askic V
le 13 Déc 2022
Modifié(e) : Askic V
le 13 Déc 2022
This shouldn't be a big problem in Matlab code. The most work is in defining input signal. Here's one example:
close all
clc
num = 0.5;
den = [20 1];
% Create transfer function
G = tf(num,den);
t = 0:0.01:50;
% Creting pulse:
u = ones(size(t));
u(t >= 20 & t < 40) = -1;
% Simulate
y = lsim(G, u, t);
subplot(211)
plot(t,u)
subplot(212)
plot(t,y)
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur General Applications dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!