TF function on Simulink
Mostra commenti meno recenti
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 Commenti
Azzi Abdelmalek
il 28 Feb 2014
Modificato: Azzi Abdelmalek
il 28 Feb 2014
What do you want to do?
Manos
il 28 Feb 2014
Ryan Rizzo
il 21 Mar 2018
Hi Manos, how did you manage to solve this issue?
Risposte (1)
Rick Rosson
il 28 Feb 2014
0 voti
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 Commento
Manos
il 28 Feb 2014
Categorie
Scopri di più su Discontinuities in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!