怎样用MATLAB 画函数 y=-1/x+2*10^-10/x^9 的图形?已知x=(0.064,0.068,0.072,0.074,0.078,0.082,0.09,0.0961,0.1153,0.13,0.21,0.0.0.1)y=(7.2.-2.-5,-7.-8.75,-8.75,-7.-5,-2.-1.75,-1.375,-1.042)函数y=-a/x+b/
来源:学生作业帮助网 编辑:作业帮 时间:2024/08/27 02:22:54
怎样用MATLAB 画函数 y=-1/x+2*10^-10/x^9 的图形?已知x=(0.064,0.068,0.072,0.074,0.078,0.082,0.09,0.0961,0.1153,0.13,0.21,0.0.0.1)y=(7.2.-2.-5,-7.-8.75,-8.75,-7.-5,-2.-1.75,-1.375,-1.042)函数y=-a/x+b/
怎样用MATLAB 画函数 y=-1/x+2*10^-10/x^9 的图形?
已知x=(0.064,0.068,0.072,0.074,0.078,0.082,0.09,0.0961,0.1153,0.13,0.21,0.0.0.1)
y=(7.2.-2.-5,-7.-8.75,-8.75,-7.-5,-2.-1.75,-1.375,-1.042)
函数y=-a/x+b/x^9
请问如何用matlab拟合求出方程中的位置参数a、b。
怎样用MATLAB 画函数 y=-1/x+2*10^-10/x^9 的图形?已知x=(0.064,0.068,0.072,0.074,0.078,0.082,0.09,0.0961,0.1153,0.13,0.21,0.0.0.1)y=(7.2.-2.-5,-7.-8.75,-8.75,-7.-5,-2.-1.75,-1.375,-1.042)函数y=-a/x+b/
拟合参数,采用多元线性回归,程序如下:
clear;
clc;
x = [0.064 0.068 0.072 0.074 0.078 0.082 0.09 0.0961 0.1153 0.13 0.21 0.4 0.6 0.8 1];
y = [7.5 5 2.5 0 -2.5 -5 -7.5 -8.75 -8.75 -7.5 -5 -2.5 -1.75 -1.375 -1.042];
X1 = 1./x;
X2 = 1./(x.^9);
myX = [ones(1,length(y)); X1; X2]';
myY = y';
[B,BINT,R,RINT,STATS] = regress(myY,myX)
结果如下:
B =
-1.8715
-0.4460
0.0000
BINT =
-4.7448 1.0018
-0.8086 -0.0834
0.0000 0.0000
R =
-3.3298
2.0318
3.7514
2.5732
1.7737
0.1965
-1.5877
-2.7445
-3.1088
-2.2312
-1.0052
0.4865
0.8648
1.0540
1.2755
RINT =
-5.0347 -1.6250
-2.5935 6.6572
-0.6703 8.1731
-2.1996 7.3460
-3.1138 6.6611
-4.7980 5.1909
-6.4799 3.3046
-7.4448 1.9558
-7.8155 1.5979
-7.1867 2.7242
-6.0962 4.0858
-4.4445 5.4174
-3.9320 5.6616
-3.6615 5.7694
-3.3742 5.9251
STATS =
0.7936 23.0733 0.0001 5.7103
其中B即为参数.
所以方程为:
y=-1.8715/x-0.4460/x^9
绘制图像:
yy = B(1)./x+B(2)./x.^9;
plot(x,y,'ro',x,yy,'b')
图我就不贴了,自己运行就可以看到,但可以明确告诉你用你这组数据拟合成9阶效果肯定非常的差,因为:y=-a/x+b/x^9 中1/x^9将是当x偏离1时一个非常大的数,而当x接近1时确实个很小的数,差值非常的大.另外要拟合到9阶对数据量的需求也是非常大.你这15组根本达不到好的要求
有问题欢迎追问,觉得有用,
x = [1:0.1:10];
plot(x, y)
什么东西