Using Solve with 'albersheim'

조회 수: 9 (최근 30일)
Vijay Bambal
Vijay Bambal 2019년 1월 7일
댓글: Vijay Bambal 2019년 1월 7일
I am trying to find Probability of detection (Pd) given SNR and Pfa with function 'albershiem; given values of SNR and Pfa. The code goes as under :-
syms Pd;
Pfa = 7e-10;
SNR = 14;
eqn = SNR == albersheim(Pd, Pfa);
At this stage error 'Pd expected to be numeric. Instead its type was sym' is indicated.
So the next statement soln = solve(eqn, Pd) cannot even be executed.
Request assistance.
  댓글 수: 1
Walter Roberson
Walter Roberson 2019년 1월 7일
Not all functions are written with symbolic values in mind. Looking at the code it appears to me that the way the code was written to permit efficient code generation is inconsistent with the possibility of symbolic input. That is it appears to me that if you were to copy the routine and strip out the error checking that you could arrive at something that could take symbolic inputs, that the problem is not the algorithm but rather the hooks and checking for code generation .
Looking at the calculation I would suspect there will not be a closed form solution for solve to find. solve would probably return a numeric solution .

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

채택된 답변

Torsten
Torsten 2019년 1월 7일
Pfa = 7e-10;
SNR = 14;
Pd0 = 1.0;
Pd = fzero(@(x)albersheim(x,Pfa)-SNR,Pd0);
  댓글 수: 1
Vijay Bambal
Vijay Bambal 2019년 1월 7일
Thanks. It works.
Small change. Pd is expected to be between 0 and 1. So Pd0 should be set to some intermediate value such as 0.2 instead of 1. Setting Pd0 to 1 gives error 'Expected PD to be a scalar with value < 1'.
Thanks again.

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

추가 답변 (0개)

태그

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by