MATLAB Answers

Obtain max output value Simulink

1 view (last 30 days)
Hello, I have a little doubt, someone could tell me how to get the maximum value of the output (curve shown in blue on the oscilloscope)
Thank you so much.

  0 Comments

Sign in to comment.

Accepted Answer

Ameer Hamza
Ameer Hamza on 7 Nov 2020
Edited: Ameer Hamza on 7 Nov 2020
max block is not suitable for saving the maximum value. See the example in the attached file (Saved in R2020b).

  4 Comments

Show 1 older comment
Ameer Hamza
Ameer Hamza on 7 Nov 2020
data(end) will not be available until simulation is completed. You can not use it in the test. Note that Simulink will not input a vector 'data'. At each iteration, 'data' will be a scalar number. Since you already now that data(end) is 1, so directly use it. Something like this
function Ts = fnc(data,t)
persistent flag
persistent T
if isempty(flag)
flag = 1;
T = 0;
end
if flag && (abs(data-1) < 0.05 * 1)
flag = false;
T = t;
end
Ts = T;
However, it will note the time when the output is rising, not when it is settling.
Alejandro Fernández
Alejandro Fernández on 7 Nov 2020
And where can I get the t-value of what I have in simulink? I tried with a Clock but I don't know if it's correct..
Ameer Hamza
Ameer Hamza on 7 Nov 2020
No, clock is the correct block to use here. I should be giving the correct time values.

Sign in to comment.

More Answers (0)

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!