大贤者
精华
|
战斗力 鹅
|
回帖 0
注册时间 2008-5-24
|
clear all; close all; clc;
t=[4.5 5.5 6.5 8.5 10];
x=[10000 12000 16000 19000 23000];
AGE=0.5
plot(t,x,'r*')
funky=@(b,t)b(1)*t+b(2);
beta = nlinfit(t,x,funky,[1 1])
hold on;
plot(t,funky(beta,t),'b-')
a=beta(1);
b=beta(2);
txt=sprintf('Curve fit: %.2fx + %.2f',a,b);
legend('Data',txt);
AGE_DVD=beta(1).*AGE+beta(2);
fprintf('AGE_DVD= %.2f zhang ',AGE_DVD)
结果......
AGE =
0.5000
beta =
1.0e+003 *
2.3250 -0.2750
AGE_DVD= 887.50 zhang >>
888张算什么水平? |
|