How to compute the integral?

조회 수: 1 (최근 30일)
Stef
Stef 2018년 8월 1일
댓글: Walter Roberson 2018년 8월 1일
I have a few lines of code yielding an output value R. I want to compute several values R for different alphas. Then I want to compute the integral from 0 up to alpha=0.5 over all Rs. How does this work, since I do not have an explicit function.
alpha = 0.05
Index = [10 5 9 7 8 2 3 1 4 6];
y_test = [0 0 0 0 1 1 0 0 0 1];
risk_group = ceil(alpha*length(y_test));
LDA_label = ones(risk_group,1);
real_label = y_test(Index([1:risk_group],:), :);
R = length(find(LDA_label==1&real_label==1))/length(find(y_test==1));
Int = integral(R,0,alpha)
  댓글 수: 1
Walter Roberson
Walter Roberson 2018년 8월 1일
I suspect you should be using trapz()

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by