simulink: group inputs outputs that will not be affected by auto arrange - matlab

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?

Related

How to iterate over values of models in Simulink Matlab?

I have designed a model in simulink. Generally, I generate a plot by setting the values of blocks(eg.gain) in the model and simulating the model and opening the scope block. But I need to generate different grpahs corresponding to different values of blocks(eg.gain). Basically, for different values of Gain value, I want different graphs but all in the same plot. The different values I give to my gain should be from an array. This is my model
I am using MATLAB for the first time. Please answer this in a beginner's approach
Setting The Gain Value
The values of the gain blocks can be can be set as variables rather than constants i.e. you can give a gain block the value of K in the settings panel.
You can then create a script that gives K a value e.g;
%script to set gain and run model
K=2;
sim('Model Name Here');
This will set the value for your gain block and run the model.
Saving The Output
In the sinks section of the simulink library browser is a block called To Workspace, this allows you to send any output value to the MATLAB workspace in multiple formats with a name that you define.
Your simulink model will now look something like this;
Now you can create a script that sets a gain value for your model, runs the model and saves the output to your workspace. With a couple of for loops and you can produce an array of inputs and outputs for your system.
From here you should be able to plot the inputs and outputs on the same graph using the well documented plot function.

How to Add external frequency inputs in the analog filter design block simulink in matlab

I want to be able to externally have inputs for the lower passband edge frequency and higher passband edge frequencies for the butterworth filter block in the simulink signal processing toolbox in matlab. How can I achieve this. Currently you'll have to click the block to specify these frequencies and this is not possible at runtime.
Regards,
Alfred
Basically you are asking for a filter that has time varying parameters. The Butterworth filter block does not allow for this, and cannot be modified to do so, so you are going to have to roll your own. This can be achieved in several ways:
Determining the difference equations that you need to implement, then creating a filter out of fundamental blocks (product, summation and unit delay blocks) where the "parameters" you want to change are fed into the product blocks as signals.
Using a block such as Transfer Fcn Direct Form II Time Varying. (This assumes you can parameterize the changes you need as a gain-scheduled signal.)
Write an S-Function (or perhaps a MATLAB Function block) to implement any detailed/specific functionality.

How to draw complex signals in simulink

I want to draw the output from a QPSK modulator in simulink
but scope block couldn't do that and a message say that the signal is complex and so scope couldn't draw it.
How can I plot such signal and what a block could be used to get the output from QPSK modulator.
thanks
You need to separate it into real and imaginary parts using the Complex to Real-Imag block and then you can plot those signals on a scope. If you want them on the same scope, you can either change the scope parameters to have 2 inputs (similar to subplot in MATLAB) or multiplex the two signals together with a Mux block (to have two traces on the same set of axes).
I think it is better to put a raised cosine transmit filter after the QPSK modulator then plot the output using timescope

Storing signal as vector for input to Matlab Function Block - Simulink

I'm trying to build a Simulink model containing a "s-function block" simulating a continuous process with a "Matlab Function Block" that use the input and output from s-function.
But I need the input to the "Matlab Function Block" with differents values of the same signal over time. That is, a vector with different sampling times for each input to "Matlab Function Block". This will be needed for testing identification techniques.
How could I do this?
Thank you
Assuming you are using a fixed-step discrete solver, and that you don't have too many values of the same signal to hold, you could use Unit Delay blocks to get the value of the signal at previous time steps. You can then mux all these signals together to form your vector input. Obviously, the practicality of it is limited by how many values of the signals you need to have (and buffer).

Why would an interpreted MATLAB function block be evaluated twice in Simulink?

I have a Simulink model that includes the following subsystem.
The bm_train_adapter block will call a MATLAB function of the same name, passing all the input arguments in a single vector.
The subsystem has been given a sample time of 900 (secs), which is why all the signals are colored in red (for discrete signals).
However, in the debugger I have observed that the bm_train_adapter function gets called twice at each simulation timestep. This yields horribly wrong results since the function includes side-effects.
Why is Simulink calling my interpreted MATLAB function more than once per timestep? How can I prevent this?
I think this is because of your solver setup. In your Configuration Parameters window, check out the Solver Options pane.
I believe the discrete and ode1 solvers will call once per timestep. ode2 will call twice per timestep, ode4 will call 4 times per timestep, etc.
This behavior is very helpful for simulating continuous dynamics, but it can be confusing when interacting with discrete elements.
The reason was that my model had algebraic loops caused by unit delay blocks in subsystems. To solve these loops, the solver had no choice but to evaluate some blocks more than once.
The solution was to move out all unit delays from their subsystems.