How to calculate the whole time that my signal values is more than zero?
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Krasimir Terziev
el 18 de Ag. de 2021
Comentada: Wan Ji
el 19 de Ag. de 2021
Hello,
I'm stuck in the middle of my model and im wondering how i can do one simple calculation.
On the picture below u can see my signal.
I try to find out how much time the signal is greather than zero? Im tring to do it with simulink blocks.
Can anyone help me with this? I will be very thankful !
Т
hank you in advance!
hank you in advance!0 comentarios
Respuesta aceptada
Wan Ji
el 18 de Ag. de 2021
Editada: Wan Ji
el 18 de Ag. de 2021
If your signal array is A, and with a time array t the same size as A.
The total time the signal is greater than zero will be
A = A(:); t = t(:);
q = A>0;
dt =[0;diff(t)];
t_positive = sum(dt(q)) % total time the signal is greater than zero
3 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Sources en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
