Effacer les filtres
Effacer les filtres

why this code doesn't give me plot line (without error)?

1 vue (au cours des 30 derniers jours)
Samira Fakhraeian
Samira Fakhraeian le 16 Nov 2021
Réponse apportée : Mihir le 11 Juin 2023
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')

Réponses (1)

Mihir
Mihir le 11 Juin 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.

Catégories

En savoir plus sur Statistics and Machine Learning Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by