Building Function for Percentage
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Yung Xi
am 23 Okt. 2019
Bearbeitet: Yung Xi
am 24 Okt. 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).
0 Kommentare
Akzeptierte Antwort
David Hill
am 23 Okt. 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Circuits and Systems 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!