1

I wrote this piece of code for plotting the 'Theoretical probability of a successful search versus Jaccard similarity' figure. The output is an empty plot. I don't know what should I change. the original function is in the picture I have replaced some variables. this is the function

clc
clear
% input paramters
b=100;
r=5;
v=2;
% function
s = linspace(0,1,0.2);
for i=0:v-1
    for j=1:size(s,2)
        sigmoid(j) = 1 - sum ((factorial(b)/(factorial(i).*factorial(b - i))).*(1-(s(j) .^r).^(b-i)).*((s(j).^r).^i));
    end
end
%plot
plot(s, sigmoid, 'linew')
xlabel('Jaccard Similarity'), ylabel('Probability of Successful Search')  
samira F
  • 11
  • 1

1 Answers1

1

The line

s = linspace(0,1,0.2);

must replaced by

s = linspace(0,1,n);

where n is integer number represents the number of s elements. The spacing between the points is (x2-x1)/(n-1), so if you want spacing "0.2" the n will be 6.

Dharman
  • 30,962
  • 25
  • 85
  • 135