固定斜率参数线性拟合。
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
ag百家官网【www.xbs3512.com】
am 13 Okt. 2022
Beantwortet: ag百家官网【gb2032 .com】
am 13 Okt. 2022
各位大佬 小弟我在做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,然后进行线性拟合
谢谢大家
0 Kommentare
Akzeptierte Antwort
ag百家官网【gb2032 .com】
am 13 Okt. 2022
固定斜率?那就相当与a*x+b,已知a 。是这样?如果是,那就是拟合一个参数b,可以不用polyfit, 换换其他函数。比如
x=sort(randi(40,15,1))
y=5*x+rand(15,1)*10
fit(x,y,'5*x+b','start',5)
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu 目标分析 finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!