필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
Samira Fakhraeian
Samira Fakhraeian 2021년 11월 16일
답변: Mihir 2023년 6월 11일
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')

답변 (1개)

Mihir
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.

카테고리

Help CenterFile Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by