Questions tagged [simulink]

Simulink® is an environment developed by The MathWorks for multidomain simulation and Model-Based Design for dynamic and embedded systems.

Simulink® is an environment developed by The MathWorks for multidomain simulation and Model-Based Design for dynamic and embedded systems. It provides an interactive graphical environment and a customizable set of block libraries that let you design, simulate, implement, and test a variety of time-varying systems, including communications, controls, signal processing, video processing, and image processing.

Some useful links:

2873 questions
4
votes
1 answer

Distinguish between simulation and HDL code generation in simulink

I am building a model using Simulink / Matlab Embedded Coder which is then converted to VHDL through HDL Coder. It should behave slightly different in simulation versus HDL, in particular concerning debug-output. Is there a programmatic way to…
mbschenkel
  • 1,865
  • 1
  • 18
  • 40
4
votes
1 answer

SIMULINK - Effects of Tunable/Changable Parameters in a masked subsystem when using Embedded Coder

I have a masked subsystem (in SIMULINK) containing several tunable parameters. The masked subsystem is a physical model and the tunable parameters are mass, length, load factor, initial dynamics (velocity, position angle), etc. Obviously, they will…
ha9u63a7
  • 6,233
  • 16
  • 73
  • 108
4
votes
2 answers

OOP Matlab inheritance issue with Matlab coder (Simulink MATLAB Function block)

I have defined an abstract base class measurementHandler < handle which defines the interface for all inherited classes. Two subclasses of this class are a < measurementHandler and b < measurementHandler. I now have a function which should return a…
4
votes
2 answers

Increase Hex2dec or dec2hex output range in Matlab

I have a strange problem with hex2dec function in Matlab. I realized in 16bytes data, it omits 2 LSB bytes. hex2dec('123123123123123A'); dec2hex(ans) Warning: At least one of the input numbers is larger than the largest integer-valued…
Ramyad
  • 107
  • 1
  • 8
4
votes
1 answer

How to plot array Y against X in Simulink?

I want to build some tank profiles and visualize them in Simulink while the simulation is running. In Matlab I usually type: plot(dX, Y), grid; where dX and Y are arrays with 20 elements (for example). Is there a scope or something in Simulink…
remus
  • 2,635
  • 2
  • 21
  • 46
4
votes
1 answer

Script to replace variables used in simulink blocks with a value

Is there a way to replace variables used in a Simulink block with actual values stored in the Matlab base workspace (or model workspace) ? e.g. In a gain block, the 'Gain' parameter is set to 'gain_A'. 'gain_A' is defined in the base workspace to…
ken
  • 3,897
  • 3
  • 22
  • 28
4
votes
2 answers

Should I use a MATLAB Function block or normal Simulink blocks?

I have read that using an Matlab Function within a Simulink model can severely impact its performance. The recommendation is to use the MATLAB Function block instead of the Interpreted MATLAB Function block. It's not clear to me how this applies…
oberotz
  • 45
  • 1
  • 6
4
votes
2 answers

How to get max from Scope (Simulink)

I would like to get only one number (maximum) from sinusoid in Matlab Simulink scope. I have a voltage measurement to measure AC voltage and current measurement. I need to find max. In my example the voltage is 231V and current is 0.26. the result…
Zs.Zs.
  • 63
  • 1
  • 1
  • 6
4
votes
2 answers

How can I create an s-function in Simulink with an input port that is a 2d array?

I am trying to create an s-function in Simulink using s-function builder that will accept a 2d array as an input. In the input ports I specify the dimensions: 2d, rows: 4, columns: 4. When I try to access the input port using f[x][y], it gives an…
Savage Reader
  • 387
  • 1
  • 4
  • 16
4
votes
2 answers

How to summarize values of the attribute across all entities

In my model there are an entity generator, some attribute function(out_attrName) and an entity sink. How do I get the sum of all attrName values of every entity? I want to get the value of every entity before it gets to the sink and accumulates this…
lak-b
  • 2,115
  • 4
  • 18
  • 30
4
votes
1 answer

Parsing Simulink models

We are looking for a library to parse Simulink model. We have found a python library but no Java solution. Are there any open source libraries that can parse Simulink 2012a models?
akuhn
  • 27,477
  • 2
  • 76
  • 91
4
votes
3 answers

Load code for a MATLAB function block at Simulink runtime

I would like to have some file, myfunc.m, in my MATLAB path and somehow load its contents into a MATLAB function block automatically just before the simulation starts. This way, I can use an external editor to write these embedded function, version…
safwanc
  • 3,351
  • 2
  • 15
  • 20
3
votes
1 answer

Unable to connect iPhone & laptop using TCP/IP

We're attempting to network between an iphone and a computer (windows 7) using TCP/IP over Wifi. We are having a lot of difficulty setting up this basic network and we were hoping to get some guidance. Server side: Currently, we are trying to use…
G.S.
  • 623
  • 6
  • 22
3
votes
1 answer

Improve running a Simulink model from a m-file

Right now, I have a x.m file that runs a y.mdl model using sim('y') command. Solver parameters from y.mdl cannot be changed and all the elements in the model are mandatory. There are no diagnostics warnings. Everything is running smoothly The output…
3
votes
1 answer

Setting custom random number generator seed even when using past SimState in Simulink

I have a problem in that I need to run multiple simulations using a previously saved SimState with different randomness seeds. I haven't managed to get this to work yet. I have tried using set_param('mod/Random Number', 'Seed', '3324') and this…
o1iver
  • 1,805
  • 2
  • 17
  • 23