Questions tagged [simulink]
Simulink® is an environment developed by The MathWorks for multidomain simulation and Model-Based Design for dynamic and embedded systems.
2,760
questions
0
votes
0
answers
8
views
Cross-compile error in Simulink: could not read symbols: file format not recognized
I would like to integrate in the Simulink model for Parrot minidrones the Matlab function readAprilTag. However when I build the code in order to make it ARM compatible I receive the error shown below....
0
votes
0
answers
5
views
ToFile block mat file format
I have set my Matlab (R2019b Update 9) to save Mat files in version 7 because I have a Python script that uses the scipy.io module to load mat files and v7.3 format is not supported by this Python ...
-3
votes
0
answers
11
views
Multism: Why is my oscilloscope a straight line? [closed]
enter image description here
This is the first half of a sound design system:voice amplification circult,but I don't know what went wrong.
0
votes
0
answers
20
views
How to check the text syntax of a Simulink model
I want to check if the mdl file of a Simulink model is syntactically correct or not. I don't want to load the model because I am only interested in the syntax errors, not the semantic issues (i.e. ...
0
votes
1
answer
14
views
Accessing Simulink Functions from inside Atomic Subchart
For reasons far outside my control, I have now been thrust into doing MATLAB/Simulink/Stateflow work. I've done the On-Ramp training, and already I despise how unintuitive it is to do things that are ...
0
votes
0
answers
16
views
Referenced Model Block with varying inport dimensions
I am having some severe trouble ith Simulink right now. I basically use parameterized Referenced Models for easy reusing of Model Blocks inside a larger model. However I have run into a problem:
...
0
votes
1
answer
11
views
How to configure a coder to generate a constant pointer to a constant variable?
My objective is to configure the Simulink Coder/Embedded Coder to generate for global parameters the following result:
extern const real32_T* const globalParameter;
Using the Custom Storage Class ...
0
votes
0
answers
16
views
ssCallSimulinkFunction with array of input argument
I simply used ssCallSimulinkFunction before with only a single argument, below is a code snippet of the example that I have run for single argument input and it works fine.
_ssFcnCallExecArgInfo ...
1
vote
1
answer
45
views
From Workspace Data Structure
I am importing data from Simulink, flip the data and then try to import the data with the Simulink block:
from workspace
This always returns a error. I tried this, but it doesn't work:
simOut = sim('...
0
votes
0
answers
16
views
Changing gain parameter in matlab function block during simulink simulation
I need to change gain/constant parameter in Simulink during the simulation. Sometimes it need to be changed and sometimes it doesn't, so I try to do it in the Matlab function block. Anyway, I didn't ...
-1
votes
0
answers
36
views
How to add Magnus effect to this Matlab code?
I am writing a Matlab code to simulate the trajectory of a soccer ball. So far I managed to display a 3d plot with it's trajectory but the Magnus effect that's in charge of the ball's rotation isn't ...
0
votes
0
answers
16
views
unable to get the base worksapce parameter value using Mex API inside a S-Function with variable typed Simulink.Parameter
I have just write a S-Function with the following content to get a specific variable by its name from the base workspace then output their value, now it works fine but just for those variable in base ...
0
votes
1
answer
22
views
Turn off Content Preview Enabled when creating a subsystem in simulink
I have a script that generates a subsystem and I want to turn off the Content Preview. My script has the following line:
add_block('built-in/Subsystem',[sys '/subsystemA'],'Position',[1150 100 1400 ...
0
votes
0
answers
12
views
Delete ripples on a Signal in Simulink
I am doing DSP and on my signal i have ripples. How can delete this ? Is there a way with a FFT Block in Simulink ? Or is there a other solution ? I don't have a clue how to start. Like in the picture....
0
votes
0
answers
23
views
Can I convert a simulink model into a scade model?
I have to convert a simulink model into a ansys scade model either using python or C. I have zero clue about how to do this, so please let me know.
0
votes
1
answer
25
views
Programmatic setting of Argument attribute for parameter in Simulink model workspace
I am using some Matlab m scripts to batch-process a set of Simulink models to produce Autosar software components using Embedded-Coder. I want some of the components to use Port-Parameters defined in ...
0
votes
1
answer
37
views
Error at running Simulink FMU in ROS: "Creation of dllfmu failed"
I'm trying to run a Simulink FMU in ROS for a co-simulation in Gazebo. I've been able to simulate and validate the FMU in Python but, when I try to load it in ROS, I'm obtaining an error.
I'm trying ...
0
votes
1
answer
24
views
When creating a Simulink library, how to flag a subsystem as a block and not a sublibrary?
I am developing a Simulink library that includes several custom subsystem blocks. When I open the library in the Simulink Library Browser, then each subsystem is displayed as a sublibrary. As a ...
0
votes
0
answers
14
views
Relational operator/Compare to zero in continuous mode are not continuous on fast signals. In discrete mode it works as expected
I'm trying to simulate some electronics stuff in Simulink. Current mode PWM, so I need to compare MOSFET current with constant.
I tried to use "Relational operator" and "Compare to zero&...
0
votes
0
answers
22
views
Use Simulink work Space variable from a C Function block
As you might know Simulink offers a block called C Function block which allows us to call legacy C code on the Simulink environment(See C-Function).
This block has an option which allows us to declare ...
0
votes
0
answers
9
views
LKAS simulink model error array out of bound
Index exceeds matrix dimensions. The array 'right_base' is empty and therefore has no valid indices.
Error in 'LKAS/Perception Unit/MATLAB Function3' (line 17)
0
votes
0
answers
11
views
When you use Simulink to generate C code, do you perform unit testing on the generated code or Simulink model or both? Does it make sense to do both?
When you consider the V-model, implementation is at the bottom. If you have created your component design (detailed design) using Simulink, then your generated code can be considered as '...
0
votes
0
answers
7
views
Implement function call to call 2 enabled subsystems at two different sample times
I want to implement function call to call 2 enabled subsystems at two different sample times using simulink or stateflow
0
votes
0
answers
22
views
How can I generate multiple references in simulink?
I am creating a simulink model for a mobile robot. The idea is to this robot goes to diferent coordinates (X, Y). I already have my controller (PI controller) and the full system simulated (motor ...
0
votes
0
answers
23
views
How can I assign a signal value to a variable in simulink?
I am fairly new to Simulink and am struggling to figure out how to assign the value of a signal to a variable for use in other locations in my model.
For instance imagine a sin wave's signal being ...
0
votes
0
answers
15
views
Simulink RSIM target does not load new solver options
I'm stuck up using RSim target options.
I've created an .exe from a Simulink model "my_model" using RSim target.
Now my aim is to run this .exe and control the solver options using a .mat ...
0
votes
1
answer
38
views
How to declare variable type for code generation in MATLAB
Consider the following variable declaration in C code:
Counter_Type counter_var;
It is a C code that a counter_var is defined with a specific type Counter_Type.
my question is: How it would be ...
0
votes
0
answers
36
views
MATLAB Error initializing OpenGL. Simulink 3D Animation cannot be used on this computer
I use MATLAB R2022a in ubuntu 20.04.
I install MATLAB 3D.
Always when I run APPS I have got this error:
MATLAB has experienced a low-level graphics error, and may not have drawn correctly.
Read about ...
0
votes
0
answers
51
views
Union data type In matlab/Simulink
I am trying to port embedded driver files to Simulink/Matlab, written in C, using C caller block
I was able to port functions that do not use a global union data type.
My final aim is to generate a C ...
0
votes
0
answers
48
views
Simulink S-Function Builder with External Library and Runtime Binary
I am trying to make a S-Function (written in C and using SDL library) in Simulink to read joystick values from the device and output them to Simulink. I used before the standard aerospace library ...
0
votes
0
answers
20
views
Simulink is flipping 2 parts of the assembly. Need help in fixing it
I am not an expert at all but need help converting the flipped output from my solidworks assembly on simulink to what it should look like shown in the first picture. the "simulink flowchart' ...
0
votes
1
answer
32
views
MATLAB nonuniform distribution of output to dynamically sized inputs
I am trying to get 3 variables from workspace to simulink. I used demux block as in the picture here:
block
It is giving me a block warning:
Nonuniform distribution of output to dynamically sized ...
0
votes
0
answers
20
views
Using C# classes as a block in simulink
I have a set of c# classes which is a passenger car vehicle model, and I'd like to use it as a block in simulink to interact with various inputs and to analyze outputs. Is there any ways I can achieve ...
0
votes
1
answer
154
views
MATLAB Simulink: Error evaluating 'InitFcn' callback of block_diagram 'BLDC_control_buck_converter'
I was modeling a vehicle with BLDC motor. After simulation when i run the model i received a Error Message .So i've no idea about bldcData data. i search it many ways but didn't find any solutions.
...
0
votes
0
answers
11
views
Concatenate variable instead of overwriting using mexPutVariable
I want my array to be concatenated to a variable with a specific name from a cmex sfunction instead of being overwritten using mexPutVariable. Is this possible? Thanks!
0
votes
0
answers
80
views
How to receive serial strings in Simulink
I am trying to read a stream of strings from serial input (COM Port) and then display the strings. The issue I am having is that the strings are of variable length and Simulink only seems to be able ...
0
votes
2
answers
55
views
Why I'm obtaining NaN in the output of a simple FMU exported from Simulink and tested in Python 3?
I'm new to the FMI standard and FMUs. I'm trying to export a FMU of a simple Simulink model, the Ohm's law in my case, to test the funcionality of the FMI standard in Python. I'm obtaining NaN in the ...
0
votes
0
answers
46
views
Matlab Subsystem change
I have this code that is supposed to change the referenced subsystems in a model to normal subsystems, because I have another script that no longer works on matlab 2020, only on 2017, due to the ...
0
votes
0
answers
32
views
Can I use set_param in matlab to change global variable
I am trying to change value of global variable during simulation run.
I found something called set_param() but I cant figure out how it work.
Lets say there is variable A I want to update inside ...
0
votes
0
answers
41
views
How to refresh global variable in simulink
I have simple transfer function in simulink.
Where I want to change values of A and B depending on some conditions during simulation.
So I created this block
Where inside I am trying to set params ...
0
votes
0
answers
32
views
PI controllers for 4 motors in a Raspberry Pi 4
I am trying to create a code for a Raspberry Pi4 where I want to control 4 motors (there is not a limited lenguage it could be Python, C or C++ code as long as it works) . I already did the simulation ...
1
vote
1
answer
33
views
Do I need to Allocate Memory when using mexGetVariable?
I am getting a variable form my MATLAB workspace via an mexGetVariable. From what I understand, a copy of the variable is made and its pointer is returned when using mexGetVariable.
Would I have to do ...
0
votes
0
answers
39
views
How to resolve PIL simulation issue under MATLAB/Simulink for Arduino
I am using Arduino DUE to do PIL simulation under MATLAB/Simulink environment. The PIL block was successfully created, but once I run the simulation an error message is raised:
Invalid payload size (...
0
votes
0
answers
19
views
simulink: group inputs outputs that will not be affected by auto arrange
In a simulink block, I have many inputs and outputs.
Is there a way to visually group the inputs/outputs that will not be affected by auto-arrange?
0
votes
0
answers
13
views
Trouble accessing and printing the parameters from a Bus in a MATLAB Script
I am trying to write a list of all the names of a bus I'm using as argument for a MATLAB Function.
Right now I'm using:
function write_list(busObject)
fileID = fopen('list.m', 'w');
fprintf(fileID, ...
1
vote
0
answers
65
views
Simulink Legacy Code Tool - custom Arduino servo write block problem
I'm trying to create my own servo.write block in Simulink for Arduino DUE deployment (and External Mode). Before you ask why if there is one available inside the Simulink Arduino Support Package, ...
0
votes
0
answers
17
views
Use matlab script to check symbol types in state chart
I am writing a script that will open a simulink model and check for all the logical comparison data types. I have four comparisons in my model, two of which are logical operators, the other two are ...
0
votes
1
answer
83
views
How to send double values over TCP/IP in Simulink Support Package for Raspberry Pi
Is it possible to send double values using the TCP/IP client block in the Simulink Support Package for Raspberry Pi?
I have been stuck for a while trying to get this to work:
but using printf("%...
0
votes
0
answers
54
views
How to search for simulink subsystems?
I have a code that compares some blocks in a Matlab R2020b Simulink application, but it keeps updating and now it doesn't work anymore, because some libraries have been changed to some "...
0
votes
0
answers
15
views
DC Motor parameter in simscape
I'm here because I'm trying to implement a DC motor model in simscape. I'm having trouble matching the motor specifications, after filling the block with the parameters taken from the datasheet the ...