필터 지우기
필터 지우기

Transfer function to filter signal Simulink to Matlab

조회 수: 1 (최근 30일)
Lorenzo
Lorenzo 2022년 12월 13일
댓글: Lorenzo 2022년 12월 13일
Hello Everyone,
I have extracted this small part of my simulink model:
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.

채택된 답변

Askic V
Askic V 2022년 12월 13일
편집: Askic V 2022년 12월 13일
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)
  댓글 수: 1
Lorenzo
Lorenzo 2022년 12월 13일
Thanks a lot! I was missing the small step with lsim.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 General Applications에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by