Afficher commentaires plus anciens
各位大佬 小弟我在做Y和X的线性拟合 代码如下
for n=1:1:5 % 5 gases
for i=1:1:7 % 7 temps
Y(i)=a*log(den(i)/1000)+log(DC(i,n)); % den:g/cm3 DC:10^-8m2/s
X(i)=c*log(T(i))-b*log(vis(i));
end
Dscfit=polyfit(X,Y,1);
plot(X,polyval(Dscfit,X),'linewidth',3);
hold on;
end
hold off;
线性拟合用polyfit是给出的最优条件下的截距和斜率,该值存在Dscfit变量中可是如果我要在固定的斜率上进行线性拟合该怎么实现呢?比如我想固定斜率为1,然后进行线性拟合
谢谢大家
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur 目标分析 dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!