I suspect you should be using trapz()
How to compute the integral?
2 次查看(过去 30 天)
显示 更早的评论
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)
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!