why this code doesn't give me plot line (without error)?
1 view (last 30 days)
Show older comments
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 Comments
Answers (1)
Mihir
on 11 Jun 2023
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 Comments
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!