MATLAB曲线拟合(含实例) 下载本文

figure;

plot(x,y,'ro',xx,yy,'b');

三、利用nlintool函数实现,代码如下: clc;

x=8:0.01:12.4; y=real(epsilon); y=y';

myfunc=inline('beta(1)+(beta(2)-beta(1))*beta(3)^2*(beta(3)^2-x.^2)./((beta(3)^2-x.^

2).^2+(2*beta(4)*x).^2)','beta','x');

nlintool(x,y,myfunc,[1 1 10 1]); 上述中y的取值是: y = 2.7332 2.7318 2.7303

2.7287 2.7272 2.7256 2.7240 2.7224 2.7207 2.7190 2.7173 2.7156 2.7138 2.7120 2.7101 2.7083 2.7064 2.7044 2.7024 2.7004 2.6984 2.6963 2.6941 2.6920 2.6897 2.6875 2.6852 2.6828 2.6804 2.6780 2.6755 2.6730

2.6704 2.6678 2.6651 2.6624 2.6596 2.6567 2.6538 2.6508 2.6478 2.6447 2.6415 2.6383 2.6350 2.6316 2.6282 2.6247 2.6211 2.6174 2.6136 2.6098 2.6058 2.6018 2.5977 2.5935 2.5892 2.5848 2.5802 2.5756 2.5709

2.5660 2.5610 2.5559 2.5507 2.5453 2.5398 2.5342 2.5284 2.5224 2.5163 2.5100 2.5036 2.4969 2.4901 2.4831 2.4759 2.4684 2.4608 2.4529 2.4448 2.4364 2.4278 2.4188 2.4096 2.4001 2.3903 2.3802 2.3697 2.3588