필터 지우기
필터 지우기

run s-function in mfile

조회 수: 12 (최근 30일)
haMed
haMed 2012년 2월 7일
hi Is it possible to run a written s-function in mfile code? I mean a provided code

답변 (3개)

Titus Edelhofer
Titus Edelhofer 2012년 2월 7일
Hi,
it depends. Level-1 S-functions in MATLAB are just simple MATLAB functions. If you call with the correct input parameters, it will work. Level-2 S-functions in MATLAB or in C will be more difficult, since providing the correct input parameters will be more difficult (MATLAB) or hardly possible (C). Perhaps you could describe in more detail what you are trying to do/achieve.
Titus

haMed
haMed 2012년 2월 7일
Actually I am looking for a provided function/code to run a Lvl1 S-function from the mfile, if exist! I know it is simple to implement but have not any time to think :)

Titus Edelhofer
Titus Edelhofer 2012년 2월 7일
Hmm, there is indeed not much to be done: the function header of an S-function looks like this:
[sys,x0,str,ts,simStateCompliance] = sfun(t,x,u,flag)
where t is Time, x is the state vector, u the input and flag a value what to compute. E.g. for computing the output function:
sys = sfun(0, [], 42.0, 2);
assuming that it is a function without continous or discrete states ...
Titus

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by