datatypes supported by simulink

1 visualización (últimos 30 días)
Ahmed Tawfeeq
Ahmed Tawfeeq el 14 de Feb. de 2012
Editada: Mathias el 13 de Oct. de 2013
Hi everybody...I am a few steps away from fulfilling my design concerning calling functions to matlab function block....but I stumbled in defining the datatypes of the function adaptfilt.lms I don't know how to define this function beacause when using class(h) where h=adaptfilt.lms, the answer is :adaptfilt.lms which is completely invalid if anyone know that simulink does not support such function type please tell my to stop my pointless trials and turn to another way..thanks alot.
  2 comentarios
Kaustubha Govind
Kaustubha Govind el 14 de Feb. de 2012
Ahmed: This question seems similar to the one already answered at http://www.mathworks.com/matlabcentral/answers/28745-matlab-simulink-supported-data-types - perhaps you should provide a snippet of your code or explain your question better if the previous answer didn't help you.
Ahmed Tawfeeq
Ahmed Tawfeeq el 15 de Feb. de 2012
Hi Kaustubha....I will explain my work,it is a part of my MSc thesis..honestly it's not a design..it's just turning the ecg matlab code in help (DSP System Toolbox/Demos/Adaptive Processing/ANC Applied to Fetal Electrocardiography)to simulink block!...the problematic code is:
h = adaptfilt.lms(15,0.00007);
[y,e] = filter(h,x,d);
..I could call all matlab codes to simulink block (creating maternal ecg..)but I stopped at (Applying Adaptive Noise Canceller) in adaptfilt.lms when I used code.extirinsic(adaptfilt.lms) , it showed an error message saying:[(Function 'adaptfilt' implicitly resolved in the MATLAB workspace. Implicit evaluation in MATLAB is not supported. Please declare this function extrinsic using coder.extrinsic('adaptfilt'), or call it using feval.)] as though it did not understand it as extrinsic......I tried to call only adaptfilt but there was an error saying:y cannot be of matlab type(y=function output)[problem of how to define the datatype of adaptfilt.lms becasue the default "double" does not match]
I tried to call them seperately ...but how to combine them?(dot problem)error message:[[Dot notation on function call return value is not allowed]].
Then I tried to follow your advice ...I used [which adaptfilt.lms]
then I copied lms.m into a seperate matlab function block ...then I fed the output of this block (equivalent to adaptfilt.lms)as input to another block,which called the "filter"function , such that , getting rid of the problem of the dot notation, but there was also an error saying:varargin cannot be used as a top level function.I don't know what to do.

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 14 de Feb. de 2012
Stop your pointless trials and turn to another way. ;-)
You will not be able to pass objects of arbitrary classes as parameters in Simulink, as best I can tell. The problem is not the dot; the problem is that the class is not one of the ones already defined for Simulink to be able to pass around.
You should consider whether it is really necessary to pass the entire adaptive filter object around. Is it not enough in your situation to construct it and use it all inside the MATLAB Function Block? If the adaptive filter is needed in several places, is it important that it be the same adaptive filter object each time, or would it be permitted to pass the construction parameters around and build it each time it was needed?
If it is important that it be the same filter object each time, then consider defining it in a MATLAB function and using "persistent" to hold on to its value in that function; then when the other locations need it, they could call the same routine with parameters indicating that they want to retrieve the object.
If you need several different adaptive filter objects simultaneously then you could use a variation of the above except that the routine returns an "id" (which could be as simple as an index in to an array) and the retrieving routine passes in the ID to indicate which particular object it needs to retrieve.

Categorías

Más información sobre Filter Implementation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by