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일

0 개 추천

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?
David Hill
David Hill 2019년 10월 23일
Yes, it is a vector

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Circuits and Systems에 대해 자세히 알아보기

태그

질문:

2019년 10월 23일

편집:

2019년 10월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by