clear all; % 清除各种变量
syms x ; % 定义x为符号变量
A=[3 2 1 1;3 2 2-x^2 1;5 1 3 2;7-x^2 1 3 2]; % 给矩阵A赋值
D=det(A); % 计算矩阵A的行列式D
f=factor(D); %对行列式D进行因式分解
X=solve(D); %求解方程“D=0”的
clear all;clc;close all;
% 方法一
figure(1);
x1=[0,0.1, 0.2, 0.3, 0.4 , 0.5,0.6,0.7];
y1=[1, 0.77, 0.65, 0.5, 0.36, 0.23,0.15,0.07];
plot(x1,y1,'-sr','MarkerSize',10);
hold on;
x2=[0,0.1, 0.2, 0.3, 0.4 , 0.5,0.6,0.7];
y2=[1, 0.85, 0.73, 0.67, 0.58, 0.53,0.4,0.3];
plot(x2,y2,'-*k');
hold on;
x3=[0,0.1, 0.2, 0.3, 0.4 , 0.5,0.6,0.7];
y3=[1, 0.92, 0.86, 0.8, 0.74, 0.68,0.55,0.45];
plot(x3,y3,'-ob');
grid on; axis([0, 0.7 ,0 ,1]); set(gca,'XTick',0:0.1:0.7) set(gca,'XTickLabel',{'0','10%','20%','30%','40%','50%','60%','70%'}) xlabel('恶意节点的比例'); ylabel('交易成功率'); legend('EigenTrust模型','PeerTrust模型','本文模型');