simulink

Simulink-Simulation with parfor (Parallel Computing)

依然范特西╮ 提交于 2019-12-22 09:30:00
问题 I asked today a question about Parallel Computing with Matlab-Simulink. Since my earlier question is a bit messy and there are a lot of things in the code which doesnt really belong to the problem. My problem is I want to simulate something in a parfor-Loop, while my Simulink-Simulation uses the "From Workspace" block to integrate the needed Data from the workspace into the simulation. For some reason it doesnt work. My code looks as follows: load DemoData path = pwd; apool = gcp('nocreate');

How to change variables in time in Simulink?

爱⌒轻易说出口 提交于 2019-12-22 00:05:35
问题 I have some processing (moving of wheelset). Wheelset has mass, it's variable and it's declaring in init.m file (for example M=1; ) Now I want that in this proccess mass of wheelset will be changed every 2 seconds. How to save the new value of mass to M variable from Simulink? 回答1: Better solution than storing variable to workspace, changing it in workspace and reading it back to simulation (I am not even sure if this is allowed) is to change it within simulation itself and use that variable.

Circular Buffer in Simulink

痴心易碎 提交于 2019-12-19 04:14:22
问题 I would like to implement a very huge (10^6 Elements - fixed size) circular buffer in pure Simulink model (no further toolboxes, no S-Function ). At some points I need to read some elements (anywhere, not just begin or end). The following solutions I can not use: "Queue Block" or "Buffer Block" (I have no Signal Processing Toolbox available) "Discrete Delay" ( I need a hugh buffer and will not place 10^6 delays into the model) "Sim Events" (I need to generate code from this model) The "S

Slowing Down Simulink

不羁的心 提交于 2019-12-18 09:37:48
问题 I have a simulation that runs in Simulink with input base on a set of 5000 samples. With my simulation time set to 5000 steps, the model runs (in about 2 seconds) and then I get the results. Is there a way I can change my model so that it runs more slowly and I can see the results change as the simulation progresses? I haven't touched Matlab or Simulink for about 12 years so assume I'm a noob. I'm sure the information is there somewhere in one of the manuals I just don't know what to look for

Matlab 2013b generated code produces Undefined symbols for architecture x86_64 error in mex

心不动则不痛 提交于 2019-12-18 09:06:18
问题 I have a C-Code generated by the Simulink Coder that I need to use in a C S-function. This may sound a bit strange but I need this Code to be executed multiple times within the s-function before writing the outputs of the s-function (it's an evolutionary algorithm that needs to simulate a prediction for a lot of individuals before evaluation and ranking...but those details do not really matter). The Problem is that I seem to have a problem with the 64bit instruction set when trying to mex my

3rd-order rate limiter in Simulink? How to generate smooth triggered signals?

社会主义新天地 提交于 2019-12-18 09:01:13
问题 First for those, who are not familiar with Simulink, there is a imaginable outside-Simulink partial solution: I need to create a vector satisfying the following conditions: known initial value a1 known final value a2 it has a pre-defined step size, but the length is not pre-determined the first derivative over the whole range is limited to v_max resp. -v_max the second derivative over the whole range is limited to a_max resp. -a_max the third derivative over the whole range is limited to j

Deployment of Simulink Models

烈酒焚心 提交于 2019-12-18 08:59:03
问题 I have been trying to find out how to deploy a Simulink model. There are possibilities and problems as well. If I use Simulink Coder how can I find the generated code on my computer? Where is it saved as a file or package of files? Can we deploy Simulink as .NET Assembly? If we can, where can I find a detailed documentation about it. Is there any other way to use my Simulink model standalone? Thank you for any effort. 回答1: By default all the code gets placed into a folder, in the current

Efficient colon operator for multiple start and end points

六月ゝ 毕业季﹏ 提交于 2019-12-17 16:39:10
问题 Suppose I have the following two variables: start_idx = [1 4 7]; end_idx = [2 6 15]; I want to efficiently (no for loop if possible) generate a single row which consists of the colon operator being applied between corresponding elements of start_idx and end_idx . For this example, this would result in: result = [1:2 4:6 7:15]; Therefore: results = [1 2 4 5 6 7 8 9 10 11 12 13 14 15]; The method to do this should be usable inside Simulink's MATLAB Function block. Thank you very much! 回答1: Here

Accumulator in Simulink

二次信任 提交于 2019-12-14 03:58:49
问题 I have a MATLAB function block in simulink and for each step simlulink does I want to input a counter with increment 1. Ex: 1st Step -> Acc=1 2nd Step -> Acc=2 I tried using a Count up block + Pulse generator but the time step of simulink is not constant. Any ideas? 回答1: A common way to do this is to use a sum and a memory block with an initial condition of 0. It should count steps in both fixed and variable step simulations. In fact I believe this would be build and perform very much like an

How to convert a data acquisition Matlab script to Simulink?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 23:40:35
问题 The Matlab script which I wrote is going to be used as a feedback for my control system. I have downloaded a library done called "Custom Arduino Library for HX711" by Nicholas Giacoboni. I want to convert a Matlab script which I wrote Matlab script. I have also tested the script by itself and it works. HX711 is a load cell amplifier ADC converter. function data = Loadcell() eml.extrinsic('arduino','addon','read_HX711') a = arduino('COM5','Mega2560','libraries','ExampleAddon/HX711'); scale =