Building Function for Percentage
조회 수: 2 (최근 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).
댓글 수: 0
채택된 답변
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Circuits and Systems에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!