Minimum Block from Simulink

2 Ansichten (letzte 30 Tage)
Nadia
Nadia am 10 Feb. 2013
Hi there,
If I had the following vector:
[2.34 50.3 21.9 1.75 22.8 50.1]
and want to find the minimum value with its index, how can I built it in Simulink please? for the vector above the minimum value is 1.75 and the index is 4.
However, I've tried Minimum block but it seems that it does not meet my requirement. Could you please help with this.
Many thanks, Nadia
  6 Kommentare
Azzi Abdelmalek
Azzi Abdelmalek am 10 Feb. 2013
Post the setting of your from workspace block
Nadia
Nadia am 10 Feb. 2013
sample time: 1
Interpolate data is active high Form output after data value by : Extrapolation

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 10 Feb. 2013
Bearbeitet: Azzi Abdelmalek am 16 Feb. 2013
If your vector comes from a constant block, for example, you can use matlab function block where you will put a code below:
function [min_value,index]=fcn(v)
[min_value,index]=min(v)
%
  9 Kommentare
Azzi Abdelmalek
Azzi Abdelmalek am 17 Feb. 2013
Bearbeitet: Azzi Abdelmalek am 17 Feb. 2013
No, If you want for example the sequences
2 3 4 at 0s
5 6 7 at 1s
8 9 10 at 2s
2 3 9 at 3s
Then in from workspace block set data to x with
x=[0 2 3 4
1 5 6 7
2 8 9 10
3 2 3 9]
In this case, the sample time should be 1s and stop time 3s
Nadia
Nadia am 18 Feb. 2013
have you tried that in Simulink please?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Simulink Functions finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by