TF function on Simulink

조회 수: 3 (최근 30일)
Manos
Manos 2014년 2월 28일
댓글: Ryan Rizzo 2018년 3월 21일
Hello I am trying to create a MATLAB function on simulink that ,between others, requires the use of the 'tf' function . Problem is I can't really find a way to use the output of the 'tf' function since it's an mxarray. So when I run something like this
function y = fcn(u)
%#codegen
coder.extrinsic('tf')
g=tf([1],[1 1]);
y=0;
y=g*u;
I get this error: MATLAB expression 'mtimes' is not numeric. Block MATLAB Function (#36) While executing: none . Initializing g gives me the 'is not numeric' error so it won't help... So I was wondering if there is anyway to get it done - the scripting way, I know I can use transfer function simulink blocks etc...Thanks in advance. (I am using Matlab R2012b btw)
  댓글 수: 4
Manos
Manos 2014년 2월 28일
편집: Manos 2014년 2월 28일
What I am asking is : If there wasn't a "Transfer Function" block on Simulink already , how would you "design" it manually using a matlab function block?
Ryan Rizzo
Ryan Rizzo 2018년 3월 21일
Hi Manos, how did you manage to solve this issue?

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

답변 (1개)

Rick Rosson
Rick Rosson 2014년 2월 28일
Multiplication is not the same thing as convolution. This approach will not work. You need to write a function that performs continuous time convolution. The only way to do that is to approximate the solution by approximating the continuous integral as a discrete summation over a small sample size. It should be possible, but not easy or fun.
Why not just use the TF block provided by a Simulink? No sense reinventing the wheel.
  댓글 수: 1
Manos
Manos 2014년 2월 28일
But since G is in the frequency domain isn't multiplication correct? Why would I have to use convolution??? (I know it makes absolutely no sense trying this the long way, I am just really stubborn :P ) Thanks a lot for your answer Rick!

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by