用matlab 双对数坐标下的指数分布拟合

2024-12-20 21:58:12
推荐回答(1个)
回答1:

参考代码:

x=[1,2,3,4,5,6,8];
y=[269/288,40/288,33/288,6/288,3/288,2/288,1/288];
loglog(x,y,'.')
c=[ones(length(x),1) log10(x(:))]\log10(y(:));
xi=1:10;
yi=10.^(c(1)+c(2)*log10(xi));
hold on
loglog(xi,yi,'r-')
legend('原始数据','拟合数据')
xlabel x; ylabel y