How to use exp() and powers ^ in uncertain matrixes?
조회 수: 1 (최근 30일)
이전 댓글 표시
I am trying to represent a thermistor using the Robust Control Toolbox.
I've created ureal objects to represent the thermistors base tolerance and beta and now want to create a matrix that represents the resistance.
ntcBase = ureal('ntcBase',2200,'Percentage',5)
ntcBeta = ureal('ntcBeta',3500,'Percentage',1)
ntcR = exp(ntcBeta)
I'm having issues getting exponentials and powers working in umats where the power is a ureal object and get the following error.
untitled
ntcBase =
Uncertain real parameter "ntcBase" with nominal value 2.2e+03 and variability [-5,5]%.
ntcBeta =
Uncertain real parameter "ntcBeta" with nominal value 3.5e+03 and variability [-1,1]%.
Check for incorrect argument data type or missing argument in call to function 'exp'.
Error in untitled (line 4)
ntcR = exp(ntcBeta)
Are these operators supported with these objects, or am I missing something else?
Thanks for the help
댓글 수: 0
채택된 답변
Steven Lord
2023년 6월 29일
ntcBase = ureal('ntcBase',2200,'Percentage',5)
Let's see what operations are defined for this class.
methods(ntcBase)
The list of methods for this type of object does not include exp so it is not defined for this class. To double-check, let's see what would be called if you ran the command you tried:
which -all exp(ntcBase)
Compare with the following, which correctly identifies the exp function for double arrays:
which -all exp(1)
The power function (the .^ operator) is not listed in the methods list, but the mpower function (the ^ operator) is. Since ntcBase is a scalar, the two would perform equivalent operations.
y1 = ntcBase^2
y1.NominalValue
2200^2
y2 = ntcBase.^2
I'm not sure why the class doesn't define power. [Robust Control Toolbox is not my area of expertise.] This seems like a reasonable enhancement request to file with Technical Support. I could see exp being a little bit trickier to implement, though.
댓글 수: 2
Steven Lord
2023년 6월 29일
From a little experimentation it looks like the mpower operator for ureal objects expects the base to be a ureal and the exponent to be an integer valued scalar number. The mpower function is asking questions (with the iosize utility function) about the first input that make sense for a ureal but not for a double value like exp(1).
ntcBase = ureal('ntcBase',2200,'Percentage',5);
ntcBase ^ 0.5
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Uncertain Models에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!