Building Function for Percentage

9 次查看(过去 30 天)
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).

采纳的回答

David Hill
David Hill 2019-10-23
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 个评论
Yung Xi
Yung Xi 2019-10-23
编辑:Yung Xi 2019-10-23
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?

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Circuits and Systems 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by