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
7
votes
2 answers

Iterate through a structure in MATLAB without 'fieldnames'

The usual way to iterate through a struct data type in MATLAB is using the fieldnames() function as done in: mystruct = struct('a',3,'b',5,'c',9); fields = fieldnames(mystruct); for i=1:numel(fields) mystruct.(fields{i}); end Unfortunately,…
unndreay
  • 353
  • 3
  • 7
7
votes
1 answer

Convert function to Simulink block

How do I convert from a function, that I have written as an m-file, into a block in a Simulink model?
stanigator
  • 10,768
  • 34
  • 94
  • 129
7
votes
1 answer

Kalman filter in computer vision: the choice of Q and R noise covariances

I read some works about Kalman filter for CV object tracking but I can't find some reference about the choice of: 1)the process noise covariance Q; 2)Measurement noise covariance R. So far I have realized that the model is equation of motion…
cyberdyne
  • 426
  • 3
  • 5
  • 23
6
votes
2 answers

Will this technique reduce the MATLAB realtime workshop coder compilation time?

My workplace use MATLAB and sub-products Simulink, Realtime workshop (RTW), RTW Embedded Coder. We have a large simulink model that is compiled to C then to an object file for loading onto the embedded target. The whole compilation process takes ~3h…
Craig
  • 991
  • 1
  • 13
  • 28
6
votes
2 answers

Integer to Binary Conversion in Simulink

I know its a very basic question. But still, I am struggling to convert Binary to Integer and vice-versa in Simulink. I could use a function block and use inbuilt Matlab functions to do it. But I, intend to use the Simulink blocks to convert Binary…
Kiran
  • 8,034
  • 36
  • 110
  • 176
6
votes
2 answers

From SIMULINK to workspace FFT?

If I want to plot the PSD of a simple sinusoidal wave in Matlab, I would do something like the following: Fs = 1000; t = 0:1/Fs:1-(1/Fs); x = cos(2*pi*100*t) ; N = length(x); xdft = fft(x); xdft = xdft(1:N/2+1); psdx = (1/(Fs*N)) *…
AhmedWas
  • 1,205
  • 3
  • 23
  • 38
6
votes
4 answers

Efficient colon operator for multiple start and end points

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…
space_voyager
  • 1,984
  • 3
  • 20
  • 31
6
votes
2 answers

transfer doubles between java and simulink using udp

I need to transfer decimal values between Java program and a Simulink model, to do so i use UDP sockets, they are no problem in the java side. In Simulink i am able to send the values using 'Stream Output' block, but the problem presents while…
mkm
  • 122
  • 1
  • 9
6
votes
4 answers

Diff between Simulink models .slx

I am using Git and I am using MATLAB/Simulink. I know that there is some kind of integration in the new versions of MATLAB/Simulink with Git but I was wondering if there is an easy way to read a git diff between 2 Simulink models which are of the…
desmond13
  • 2,913
  • 3
  • 29
  • 46
6
votes
1 answer

What files should I add to the .gitignore when using MATLAB and Simulink?

I would like to know what files I should add to the .gitignore file when I am using MATLAB and Simulink. Should the files slx.original be added?
lmiguelvargasf
  • 63,191
  • 45
  • 217
  • 228
6
votes
1 answer

Implementing custom MATLAB functions in Simulink

I would like to use a custom MATLAB function in Simulink. So far I have done it by placing an embedded MATLAB function block. However, if the custom function contains another custom function the compile process fails. Here is the example of function…
Niko Gamulin
  • 66,025
  • 95
  • 221
  • 286
6
votes
2 answers

Make signal names coming from library links unique?

OK, I've been struggling with this for a while. What is the best way to accomplish the following: where Reaction Wheel 1-4 are links to the same block in a library. When the Speed Counter, Speed Direction and Current signals are added to the final…
Rody Oldenhuis
  • 37,726
  • 7
  • 50
  • 96
6
votes
4 answers

How to flip a Simulink block VERTICALLY?

I have been trying to flip a block in Simulink along the vertical but I couldn't figure out how this can be done. For example, when the "sincos" trigonometric function block is inserted, the sin output is up and the cos output is down. I want the…
6
votes
1 answer

Increasing simulation time in a Monte Carlo simulation in Matlab/Simulink

I'm running Monte Carlo simulation for a Simulink model with a Matlab script that looks more or less like this : model = 'modelName'; load_system(model) for ii = 1 : numberOfMC % Some set_param... % Some values are set sim(model); …
moumoute6919
  • 2,406
  • 1
  • 14
  • 17
6
votes
1 answer

In Simulink, are Goto and From blocks generally considered bad style?

I was working on a Simulink model recently and was using Goto and From blocks to keep a very busy system from becoming a twisted mess of wires. I was informed that I was not to use Goto and From blocks as they are considered bad style (at least,…
celestialorb
  • 1,901
  • 7
  • 29
  • 50