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 Center および File ExchangeNumerical Integration and Differentiation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by