Building Function for Percentage

6 visualizaciones (últimos 30 días)
Yung Xi
Yung Xi el 23 de Oct. de 2019
Editada: Yung Xi el 24 de Oct. de 2019
Hello. For my client, want to build function in Matlab for 1 scaler input (speed limit for circuit) and 1 scaler input (speed of some signals around circuit).

Respuesta aceptada

David Hill
David Hill el 23 de Oct. de 2019
function pD = percentDiff(limit,speedM)
pD=100*(speedM-limit)/limit;
end
Not sure what you want for good percentage difference. Do you want 'good' to be <limit (negative %diff) or <-valve? Then,
function [pD,tf] = percentDiff(limit,speedM,value)
pD=100*(speedM-limit)/limit;
tf=pD<-value;%good would be value of 1 in the tf vector
end
  2 comentarios
Yung Xi
Yung Xi el 23 de Oct. de 2019
Editada: Yung Xi el 23 de Oct. de 2019
Hello David.
For pD, why do you write SpeedM? I confirm this is the speed of more than 1 signal in the circuit? It is not the speed for just 1 signal but a group of signals? Is that possible?
What does tf mean in your example?
David Hill
David Hill el 23 de Oct. de 2019
Yes, it is a vector

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Circuits and Systems en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by