资源简介
自抗扰控制,最速跟踪微分器Matlab仿真,用S函数写的,参数已经调好,MATLAB configure得设置为fix step ,采样时间设置为1e-3(与步长h相同即可)。
代码片段和文件信息
/*
* sfuntmpl_basic.c: Basic ‘C‘ template for a level 2 S-function.
*
* -------------------------------------------------------------------------
* | See matlabroot/simulink/src/sfuntmpl_doc.c for a more detailed template |
* -------------------------------------------------------------------------
*
* Copyright 1990-2002 The MathWorks Inc.
* $Revision: 1.27 $
*/
/*
* You must specify the S_FUNCTION_NAME as the name of your S-function
* (i.e. replace sfuntmpl_basic with the name of your S-function).
*/
#define S_FUNCTION_NAME ADRC_TD
#define S_FUNCTION_LEVEL 2
/*
* Need to include simstruc.h for the definition of the SimStruct and
* its associated macro definitions.
*/
#include “simstruc.h“
#include
/* Error handling
* --------------
*
* You should use the following technique to report errors encountered within
* an S-function:
*
* ssSetErrorStatus(S“Error encountered due to ...“);
* return;
*
* Note that the 2nd argument to ssSetErrorStatus must be persistent memory.
* It cannot be a local variable. For example the following will cause
* unpredictable errors:
*
* mdlOutputs()
* {
* char msg[256]; {ILLEGAL: to fix use “static char msg[256];“}
* sprintf(msg“Error due to %s“ string);
* ssSetErrorStatus(Smsg);
* return;
* }
*
* See matlabroot/simulink/src/sfuntmpl_doc.c for more details.
*/
/*====================*
* S-function methods *
*====================*/
/* Function: mdlInitializeSizes ===============================================
* Abstract:
* The sizes information is used by Simulink to determine the S-function
* block‘s characteristics (number of inputs outputs states etc.).
*/
static void mdlInitializeSizes(SimStruct *S)
{
/* See sfuntmpl_doc.c for more details on the macros below */
ssSetNumSFcnParams(S 0); /* Number of expected parameters */
if (ssGetNumSFcnParams(S) != ssGetSFcnParamsCount(S)) {
/* Return if number of expected != number of actual parameters */
return;
}
ssSetNumContStates(S 0);
ssSetNumDiscStates(S 0);
if (!ssSetNumInputPorts(S 1)) return; //input r h x0 N
ssSetInputPortWidth(S 0 4);
ssSetInputPortRequiredContiguous(S 0 true); /*direct input signal access*/
/*
* Set direct feedthrough flag (1=yes 0=no).
* A port has direct feedthrough if the input is used in either
* the mdlOutputs or mdlGetTimeOfNextVarHit functions.
* See matlabroot/simulink/src/sfuntmpl_directfeed.txt.
*/
ssSetInputPortDirectFeedThrough(S 0 1);
if (!ssSetNumOutputPorts(S 1)) return; //output x1 x2
ssSetOutputPortWidth(S 0 2);
ssSetNumSampleTimes(S 1);
ssSetNumRWork(S 0);
ssSetNumIWork(S 0);
ssSetNumPWork(S 0);
ssSetNumModes(S 0);
ssSetNumNonsampledZCs(S 0);
ssSetOptions(S1);
}
/* Function: mdlInitiali
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 8055 2019-07-01 20:17 ADRC_TD.c
文件 35328 2019-06-18 19:44 ADRC_TD.mexw64
文件 45114 2019-06-27 15:10 TD_TEST.mdl
相关资源
- 汽车主动悬架控制器建模仿真程序代
- MIMO_DOAMIMO-雷达DOA估计中克拉美罗界
- 随机生产模拟matlab程序
- 雷达杂波瑞利分布模型MATLAB仿真
- 基于肤色的人脸检测
- 卡尔曼滤波matlab仿真程序
- 基于matlab的路面裂缝检测识别系统设
- 基于matlab的DCT变换对灰度图像进行压
- 基于MATLAB图像处理的汽车牌照识别系
- 基于matlab的神经网络dropout层
- 基于matlab的svr代码
- 使用matlab 实现DTW算法
- 基于粒子群算法的优化模型matlab程序
- 遗传算法完整MATLAB程序
- MATLAB灰色关联度代码
-
simuli
nk计数器、累加器.zip - 仿真了两径瑞利衰落信道模型和多径
- matlab读取并显示遥感img图像,包含单
- 快速随机搜索树RRT算法
-
MATLAB模糊控制及simuli
nk仿真 - psot工具箱及使用说明.zip
- 基于matlab的最小生成树prim算法
- matlab拟合程序
- GPS捕获跟踪定时同步的matlab代码
- 龙贝格算法MATLAB程序
- Matlab2017a许可证
- 基于聚类的路标检测K-meansMATLAB(RGB)
- dijkstra算法的MATLAB实现258163
- matlab程序.rar
- H-a-A-Wishart分类.zip
评论
共有 条评论