【问题标题】:why this code doesn't give me plot line (without error)?为什么这段代码没有给我情节线(没有错误)?
【发布时间】:2021-12-27 18:44:57
【问题描述】:

我编写了这段代码来绘制“成功搜索的理论概率与 Jaccard 相似度”的图。输出是一个空图。我不知道我应该改变什么。原始函数在图片中我已经替换了一些变量。 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')  

【问题讨论】:

    标签: matlab sigmoid


    【解决方案1】:

    线

    s = linspace(0,1,0.2);
    

    必须替换为

    s = linspace(0,1,n);
    

    其中n是整数,代表s个元素的个数。点之间的间距为 (x2-x1)/(n-1),因此如果您想要间距“0.2”,则 n 将为 6。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-03-25
      • 1970-01-01
      • 1970-01-01
      • 2016-09-18
      • 1970-01-01
      • 2015-10-30
      • 2022-06-12
      • 1970-01-01
      相关资源
      最近更新 更多