why this code doesn't give me plot line (without error)?
1 次查看(过去 30 天)
显示 更早的评论
I wrote this piece of code for plotting 'Theoretical probability of a successful search versus Jaccard similarity' figure. The output is an empty plot. I dont know what should I change. the original function is in the picture I have replaced some variables.
clear
clc
% input paramters
% b=100, r=4
v=2;
s=0:0.1:10;
for i=0:1
for j=1:size(s,1)
pr(j) = 1 - sum ((factorial(100)/(factorial(i).*factorial(100 - i))).*(1-(s(j).^4).^(100-i)).*((s(j).^4).^i));
end
end
plot(pr, s, 'r'), xlabel('Jaccard Similarity'), ylabel('Probability of Successful Search')
0 个评论
回答(1 个)
Mihir
2023-6-11
According to the labels mentioned, there is a mismatch between the x labels and the parameter passed the probability and for y label the parameter passed is Jaccard Similarity. Instead it should be swapped. This is the correct approach to see the expected behaviour
plot(s, pr, 'r'), xlabel('Jaccard Similarity'), ylabel('Probability of Successful Search');
Hope this helps to show the expected graph.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!