将Matlab功能块的初始条件定义为功能块中的初始条件 [英] Define Initial condition for matlab function blocks as an Initial condition in sfunction block

查看:222
本文介绍了将Matlab功能块的初始条件定义为功能块中的初始条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在matlab s-function空间中定义了'my sys',如下所示:

I have defined 'my sys'in matlab s-functionspace as below:

    ....
            sys = simsizes(s);


        case 1  % derivative

                sys = mysys(t,x,u,opts);


        case 3  % output

            sys = x ;
.....

,然后将系统状态的初始条件(dx0)放在s函数参数空间中. S-功能参数块

and I put initial condition (dx0) of system states in s-function parameters space.S-function parameters block

现在我已经在matlab function block中定义了my sys,但是没有什么像s函数块那样可以将我的初始(dx0)条件放入其中. matlab功能块中的sys

Now I have defined my sys in a matlab function block but there is nothing like s-function block to put my initial (dx0) condition in it. sys in matlab function block

我想知道如何为matlab功能块定义dx0?!

I'm interested to know how can I define dx0 for matlab function block?!

推荐答案

您似乎在混淆三件事.

  1. 第一件事是您要发布的MATLAB代码,但我不确定它应该准确地放在哪里.

  1. The first thing is the MATLAB code you're posting which I'm not sure is supposed to go where exactly.

第二件事是您链接的第一张图片.这确实显示了S函数的对话框,该对话框要求您为代码提供.c文件(使用C语言).也许您打算使用Level 2 S函数,您可以在其中输入MATLAB代码.

The second thing is the first picture you're linking. That indeed shows the dialog box of an S-function, which requires you to provide a .c file (in the C language) for the code. Perhaps you were intending to use a Level 2 S-function, where you can enter MATLAB code.

第三件事是您要链接的第二张图片.其中显示了一个嵌入式MATLAB函数,该函数与2级S函数不同,这解释了为什么看不到可以输入参数的对话框.

The third thing is the second picture you're linking. That one shows an embedded MATLAB function, which is not the same as a Level 2 S-function, which explains why you don't see a dialog box where you can enter a parameter.

您想做的(我想)是使用某些函数来计算导数,即xdot = f(x).您可以使用以下任一方法进行操作: -嵌入式MATLAB函数 -S功能 -2级S功能 所有这些都可以设置初始条件.但是,您可能希望集成派生工具.在这种情况下,您希望在要添加到功能块之后的积分器块上设置初始条件.

What you're trying to do (I guess) is to calculate derivatives using some function, i.e., xdot = f(x). You can do that using either: - an embedded MATLAB function - an S-function - a Level 2 S-function All of these can set an initial condition as well. However, you probably want to integrate the derivatives. In that case you'd want to set the initial condition on an integrator block that you're adding after your function block.

这篇关于将Matlab功能块的初始条件定义为功能块中的初始条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆