How do I find if array A is element of array B within interval?
1 次查看(过去 30 天)
显示 更早的评论
Hello,
I'm looking for possibility to get True Positive/ False Negative/ False Positive values.
For example, I have two arrays
A = [1000, 1200,1200,1700];
and
B = [0, 0, 1500, 1250, 1250, 2300, 200];
A are frequencies, B are detected frequencies-vector.
First I'm using:
A = nonzeros(unique(A));
B = nonzeros(unique(B));
to avoid zeros and repeats and get:
A = [1000, 1200, 1700];
B = [200, 1250, 1500, 2300] ;
Now I want to look for:
if values B are elements of A +-var-Value
than TP = TP + 1;
if values B are not elements of A +-var-Value
than FP = FP + 1;
if values A are not elements of B +-var-Value
than FN = FN + 1;
end
when var-Value = 100;
There are 3 frequencies 1000, 1200, 1700
4 frequencies are detected 200, 1250, 1500, 2300
1200 is detected (1250 - of course of var-Value interval) -> True Positive = 1
1000 and 1700 was not detected -> False Negative = 2
200, 1500 and 2300 was wrong detected -> False Positive = 3
I find an ismember(A,B) function, but there are no interval option for +-var-Value possible
So I can use a for-loops to check it, but there are maybe better solution possible?
Thank you!
3 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!