How to compute the integral?

3 visualizaciones (últimos 30 días)
Stef
Stef el 1 de Ag. de 2018
Comentada: Walter Roberson el 1 de Ag. de 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 comentario
Walter Roberson
Walter Roberson el 1 de Ag. de 2018
I suspect you should be using trapz()

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Numerical Integration and Differentiation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by