What are the differences (if any) between Matlab system objects and class objects?

19 ビュー (過去 30 日間)
Yair Altman
Yair Altman 2013 年 1 月 10 日
編集済み: Tong Zhao 2021 年 7 月 27 日
Matlab includes a wide variety of System Objects, that seem to be standard Matlab objects (typically singletons) which derive from matlab.System ( ref ).
My question: is there any real difference between System Objects and any other class object used in Matlab?

採用された回答

Kaustubha Govind
Kaustubha Govind 2013 年 1 月 10 日
編集済み: Kaustubha Govind 2013 年 1 月 10 日
In my own words, System objects are a subset of standard MATLAB class objects which inherit from an interface class named matlab.System. The interface class specifies methods that should be implemented by an author of a System object - each of these methods determine the behavior of the System object (eg. getNumInputsImpl, getNumOutputsImpl, stepImpl, etc.). In essence, System objects provide an infrastructure/platform for you to define a "system" in MATLAB.
I think the concept of System objects will more completely resonate with Simulink users, because IMHO System objects are a lot like S-functions, except that they can be used the same way in both MATLAB and Simulink. Methods like setupImpl, resetImpl, stepImpl, releaseImpl, etc. can be used to define a system more completely, as opposed to a MATLAB function which can only define an algorithm, but not a system.
  2 件のコメント
Yair Altman
Yair Altman 2013 年 1 月 13 日
thanks, makes sense
Tong Zhao
Tong Zhao 2021 年 7 月 27 日
編集済み: Tong Zhao 2021 年 7 月 27 日
Good explanation. So the way I see, matlab system objects are implementations of an interface class that characterizes a stepped (assuming that you're utilizing the stepImpl method to step the system states) multiple input multipl output (MIMO) dynamical system (dynamical because it stores states, or rather properties in class language).

サインインしてコメントする。

その他の回答 (2 件)

Arnav Mendiratta
Arnav Mendiratta 2017 年 7 月 24 日
Here is a good blog post about system objects: https://blogs.mathworks.com/simulink/2013/09/11/the-matlab-system-block/
This post is from 2013 and since then, the syntax for some functions (like step does not require a call like step(obj) anymore) might have changed.

Sean de Wolski
Sean de Wolski 2013 年 1 月 10 日
There are a few things that come with system objects. Most importantly: codegen support. Also, large data stream processing, saved state information and fixed-point support.
  2 件のコメント
Yair Altman
Yair Altman 2013 年 1 月 10 日
ok, but how is this different from any other singleton class object that can store state information and do all sorts of fancy algorithms in its methods?
Kaustubha Govind
Kaustubha Govind 2013 年 1 月 10 日
Yair: I think the primary difference would be that all System objects have a standard interface, and the System object infrastructure automatically provides consistency checking, and possibly other services (can't think of more examples right now), that are shared by all System objects.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCreate System Objects についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by