simulink

Sampling time as an input-simulink

痴心易碎 提交于 2019-12-25 02:59:25
问题 I am trying to make a library of functions that will allow me to parameterize filters and other function. In simulink standard blocks, I am only able to set a sampling time prior, rather than take an input. Is there any ideas on how I can create this? My first approach was to use conditionals and a clock to allow this parameter to exist, but the clock cannot be parameterized either. Thanks in advance. 回答1: The only way to do this is to write each of your blocks as S-Functions. If you are

Waiting time in S-function

≡放荡痞女 提交于 2019-12-25 02:35:31
问题 I am trying to create a flashing procedure in Simulink using a S-function (C language) and I need to send some frames and the time between 2 consecutive frames should be lets say 200 milisconds. How can I implement this waiting time? Is there any possibility of implementing it? 回答1: If you want to update something every 200ms, put your S-Function into a subsystem which is triggered every 200s. 回答2: Below you can find the steps that I followed in the function: 1.create first frame 2.send first

How to plot non-linear state space models in Simulink?

柔情痞子 提交于 2019-12-25 00:24:13
问题 I am trying to plot a non-linear model in order to compare it with it's linearized counterpart. I am following this paper Nonlinear Model & Controller Design for Magnetic Levitation System and trying to reproduce the results the authors obtained. In particular I am trying to plot: The above equations can be represented in vector format as follows: I found no references on how to plot non linear state space model representations on MathWorks. The Simulink state-space block is used to implement

how to import mat file to simulink?

主宰稳场 提交于 2019-12-24 22:19:06
问题 I have a problem with .mat file and Simulink. I need to input data from .mat file to Simulink but not signals, i need to input variables in blocks. Block "From File" doesn't do any good for me since it only uses signals. Is there any way for me to use Simulink Callbacks, PreLoadFcn or InitFcn? Or is there some other way to do this? 回答1: You can specify MAT file as input for your model workspace data using Model explorer. Open model explorer from the view menu and then choose "model workspace"

PID working with sine wave as reference in simulink

拥有回忆 提交于 2019-12-24 21:33:32
问题 I have seen example of controlling output dc voltage of DC to DC buck converter using PID controller. I want to implement DC to AC converter. I tried using PID controller. Since i am comparing output AC signal(continuously varying) with reference sinusoidal signal, PID controller is not providing expected output. In case of DC to DC, both reference signal was constant. In my case, it is continuously varying sine wave. Can anyone suggest any way to get accurate DC to AC conversion? P.S. Can

how to force an application to run in one core and no other applications run in that core on windows?

孤街浪徒 提交于 2019-12-24 18:09:27
问题 I think my questions are unusual, but I wanna work on real time targeting in MATLAB Simulink, but I don't want to use XPC target. I just want no interrupt on the program (simulink) when it is running in order to have a real time interruptless control system. and in that order i can use my control module without target system. first of all, please ignore my weak english. and I have some questions: 1. can we force a core to only be used by simulink and nothing else? 2. how much usually (and how

Need to generate pulse when a signal crosses zero point in simulink?

两盒软妹~` 提交于 2019-12-24 16:26:41
问题 I have an input signal I=sin(omega*t). Which simulink model do I use in order to get a pulse every time the signal crosses zero-point? 回答1: Here's my suggestion: The transport delay block makes a delayed version of input signal. You need to make the sampling rate of this block low. Then, signs of original and delayed signals are subtracted. If signs are equal you get 0, if signs are different (zero is crossed) then you get +-2. You take absolute value and divide signal by 2 to get: 回答2: I

simulink matlab standalone executable unable to get output

人盡茶涼 提交于 2019-12-24 10:49:59
问题 I have a M-script which takes the parameter values from user via a GUI and then simulates a simulink model with the updated parameter value. I want to convert it into a standalone exe file which can run without Matlab & Simulink (i.e. only with Matlab Runtime Compiler). I'm using MATLAB 2010b 32bit. My approach: As the Matlab compiler cannot convert the sim function, I first converted my Simulink model to an exe-file using the Rapid Simulation target and then called the exe file from my

See if a signal originates from a bus in Simulink

天涯浪子 提交于 2019-12-24 09:48:19
问题 We have an S-Function that does not support bus signals in Simulink, so programmatically I am trying to find a way to determine if the signal type of an inport/outport originates from/is going to a bus so I can demux and mux the signal automatically as needed. Unfortunately, the only block property I can find that reliably tells if the port comes from or goes to a bus is if it inherits properties from the bus, which might not be true in all cases. Any idea on how to figure this out? 回答1: Well

Unit-testing and Integration Testing for Large or Medium-Complexity System Models in SIMULINK

流过昼夜 提交于 2019-12-24 09:28:46
问题 PROBLEM I have a fairly large Hydro-Pneumatic system model composed of roughly 20-25 different subsystems. Each of the subsystem is then composed of digital logic, edge delay blocks, and gateway to external output ports (real-world outputs). Additionally some of the small building blocks are legacy C code imported as S-functions in order to maximise cost-benefit ratio. Each of the subsytem model has been designed in SIMULINK with the use of basic blockset i.e. no add-on commercial blocksets