simulink

Backwards integration in Simulink

孤街醉人 提交于 2019-12-11 07:18:15
问题 Is it possible to perform backward integration in Simulink, for instance by setting the start time to t_end, the end time to t_start and setting a negative time step (-dt)? Or should I rather try an implementation in Matlab? I need a fixed-step integration scheme. I need this for a control problem with the application of Pontryagin's principle. For example, see the Section 4 of https://asco.lcsr.jhu.edu/docs/EN530_603_F2015/lecture9.pdf. 回答1: Time cannot run backwards in Simulink. You'd need

Time driven simulation backwards steps

烈酒焚心 提交于 2019-12-11 06:08:41
问题 I am looking for an alternative to Simulink that would allow to control the stepping mechanism. The same concern was raised in this question, that Simulink does not allow backwards stepping, so that complex systems x(t,u) where "changing variables" (t <- -t) requires weeks of work, cannot be controlled (u) correctly due to interdependance between past states and present decisions (u=f(x(s)),s<=t). Conceptually, the trick simply consists in manually storing previous states in memory : for a

Memory block alternative that ISN'T fixed in minor time step?

爷,独闯天下 提交于 2019-12-11 04:08:21
问题 I have a model with some inputs that are fed into a CMEX S-Function via the Memory block, and the S-Function provides outputs based on these inputs, and those inputs are fed back into the S-Function. Classic algebraic loop scenario. I was using a memory block to prevent this because our solver is usually variable-time step According to the Mathworks documentation the Memory Block, and the Unit Delay block also, are fixed in minor time step in terms of their outputs. I realize that the inputs

Adding a DC Motor to a Simscape Multibody Revolute Joint

旧城冷巷雨未停 提交于 2019-12-11 03:54:34
问题 I have the following Model of a DC motor and a Simscape Multibody Model of a 2-wheel Robot. DC Motor with Torque Output: Simscape Multibody Model of my Robot: I want to control speed of the robot (Simscape Multi-Body Model). So I want to interface the DC motor to the revolute joint of the robot. The above generated model appears to work but, the motor rotates above no-load speed and motor-torque nears stall torque as measured at the revolute joint. How would I ensure that the DC motor torque

Using fwrite in MATLAB to graph constant double values in Simulink Scope blocks?

ⅰ亾dé卋堺 提交于 2019-12-11 01:44:02
问题 I am currently trying to use UDP to send constant values from MATLAB to Simulink and then use Simulink to graph these values. Here is an image of the MATLAB code, Simulink block diagram and the graph that I am working with (note that the graph starts at a constant value of 0): http://i.imgur.com/krkulyQ.png In the MATLAB code I am using the fwrite function to send data to the Packet Input block which then outputs to the Scope block to graph the data. Specifically I would like to graph

Simulink - Output 1 every 30 seconds, 0 otherwise

こ雲淡風輕ζ 提交于 2019-12-11 00:16:41
问题 I need a subsystem that needs to output 1 at interval or 30 seconds or slightly over 30 seconds. Written in matlab code it should work like that function y = fcn(time,uplinkTimeInterval) %#codegen persistent lastTriggerTime if isempty(lastTriggerTime) lastTriggerTime = 0; end if time>=lastTriggerTime || time == 0 y = 1; lastTriggerTime = time + uplinkTimeInterval; else y = 0; end end where ulplinkTimeInterval is 30 seconds. Of course I tried to use the matlab function block with this code but

How can I automatically autoscale the plots in Simulink's Scope during a simulation?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-10 23:59:19
问题 When I want to look at signals in the scope during a simulation, I might have to click on the Autoscale button whenever the signal is out of view. Is there a way to automatically autoscale so you can always see the whole signal during the simulation? [Simulink 8.3, Matlab R2014a] 回答1: you can do that by writing a function to ask Simulink to automatically autoscale and call it every N seconds. The function I got are from here, it just basically triggers the autoscale button : % find all scope

Simulink - How to run a simulation in a simulation?

烂漫一生 提交于 2019-12-10 12:16:46
问题 I am running a simulation that contains among other things a subsystem (or referenced model) that is a simulation by itself and that needs to be run fully at certain times before resuming the main simulation. Basically, at time t the main simulation needs the outputs of the subsystem. The subsystem is then triggered and runs a simulation for 6 seconds (the subsystem simulation is time dependent). Then the main simulation uses the outputs of the subsystem. The problem here is that when the

Convert function to Simulink block

独自空忆成欢 提交于 2019-12-10 04:35:42
问题 How do I convert from a function, that I have written as an m-file, into a block in a Simulink model? 回答1: There's a video here that shows some options. Basically, use the MATLAB Function block. Or, if you want to keep the code separate (and don't care about code generation), you can use the MATLAB Interpreted Function block. 来源: https://stackoverflow.com/questions/2225248/convert-function-to-simulink-block

关于simulink格式问题

白昼怎懂夜的黑 提交于 2019-12-10 04:26:27
今天才发现新版本的matlab的simulink格式为slx,这会导致老版本的matlab打不开新版本的模型,但是新版本可以打开老版本的。老版本的格式为.mdl,两个本质都是指模型,只是版本不一样导致的。如果出现不能打开的现象,可以将格式转换一下就行。 来源: CSDN 作者: 这是小旭哦 链接: https://blog.csdn.net/zouxu634866/article/details/103462616