How to compute the integral?

1 Ansicht (letzte 30 Tage)
Stef
Stef am 1 Aug. 2018
Kommentiert: Walter Roberson am 1 Aug. 2018
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 Kommentar
Walter Roberson
Walter Roberson am 1 Aug. 2018
I suspect you should be using trapz()

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by