求matlab大神帮忙看一下程序,程序的目的是求解多元非线性方程组
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/17 23:57:18
求matlab大神帮忙看一下程序,程序的目的是求解多元非线性方程组
function P=
myfun( x,a )
F=a(1);
T=a(2);
Vx1=a(3);
Vx2=a(4);
Vy1=a(5);
Vy2=a(6);
Vz1=a(7);
Vz2=a(8);
x1=a(9);
x2=a(10);
y1=a(11);
y2=a(12);
z1=a(13);
z2=a(14);
r1=[x-x1,y-y1,z-z1];r2=[x-x2,y-y2,z-z2];r3=[-2107069.481-x1,47977
62.928-y1,-1354900-z1];r4=[-2107069.481-x2,47977
62.928-y2,-1354900-z2];
V1=[Vx1,Vy1,Vz1];V2=[Vx2,Vy2,Vz2];
P=[21.24*(dot(V2,r2)/sqrt(dot(r2,r2))-dot(V1,r1)/sqrt(dot(r1,r1)))+14.72(dot(V2,r4)/sqrt(dot(r4,r4))-dot(V1,r3)/sqrt(dot(r3,r3)))-F;
dot(r2,r2)-dot(r1,r1)+dot(r4,r4)-dot(r3,r3)-T;
(x^2)/(6378137)^2+(y^2)/(6356752.3142)^2+(z^2)/(6399593.63)^2-1;];
end
a =
zeros(14);
display('#
Pls input the known parameters: #')
a(1) =
input(' F= ');
a(2) =
input('T= ');
a(3) =
input('Vx1 = ');
a(4) =
input('Vx2 = ');
a(5) =
input('Vy1= ');
a(6) =
input('Vy2= ');
a(7) =
input('Vz1= ');
a(8) =
input('Vz2 = ');
a(9) =
input('x1 = ');
a(10) =
input('x2 = ');
a(11) =
input('y1 = ');
a(12) =
input('y2 = ');
a(13) =
input('z1 = ');
a(14) =
input('z2 = ');
display('#
Pls input the initial point: #')
x0 =
zeros(3);
x0(1) =
input('x = ');
x0(2) =
input('y = ');
x0(3) =
input('z= ');
options =
optimset('Display','iter'); % Option to display output
[x,fval] =
fsolve(@(x) myfun(x,a),x0,options)
# Pls input
the known parameters: #
F= 496.7330165
T=
-0.004422825
Vx1 =
-0.017463
Vx2 =
-8.433214
Vy1=
-1.061177
Vy2= 4.465864
Vz1=
-0.147952
Vz2 =
96.778425
x1 =
-18129715.71
x2 =
-6317131.997
y1 =
38064542.4
y2 =
41568346.16
z1 =
20260.435
z2 =
-3071223.423
# Pls input
the initial point: #
x = -2000000
y = 4000000
z= -1000000
未定义与 'double' 类型的输入参数相对应的函数'myfun'.
出错 @(x)myfun(x,a)
出错 fsolve (line 217)
fuser =
feval(funfcn{3},x,varargin{:});
原因:
Failure in initial user-supplied objective
function evaluation. FSOLVE cannot continue.
function P=
myfun( x,a )
F=a(1);
T=a(2);
Vx1=a(3);
Vx2=a(4);
Vy1=a(5);
Vy2=a(6);
Vz1=a(7);
Vz2=a(8);
x1=a(9);
x2=a(10);
y1=a(11);
y2=a(12);
z1=a(13);
z2=a(14);
r1=[x-x1,y-y1,z-z1];r2=[x-x2,y-y2,z-z2];r3=[-2107069.481-x1,47977
62.928-y1,-1354900-z1];r4=[-2107069.481-x2,47977
62.928-y2,-1354900-z2];
V1=[Vx1,Vy1,Vz1];V2=[Vx2,Vy2,Vz2];
P=[21.24*(dot(V2,r2)/sqrt(dot(r2,r2))-dot(V1,r1)/sqrt(dot(r1,r1)))+14.72(dot(V2,r4)/sqrt(dot(r4,r4))-dot(V1,r3)/sqrt(dot(r3,r3)))-F;
dot(r2,r2)-dot(r1,r1)+dot(r4,r4)-dot(r3,r3)-T;
(x^2)/(6378137)^2+(y^2)/(6356752.3142)^2+(z^2)/(6399593.63)^2-1;];
end
a =
zeros(14);
display('#
Pls input the known parameters: #')
a(1) =
input(' F= ');
a(2) =
input('T= ');
a(3) =
input('Vx1 = ');
a(4) =
input('Vx2 = ');
a(5) =
input('Vy1= ');
a(6) =
input('Vy2= ');
a(7) =
input('Vz1= ');
a(8) =
input('Vz2 = ');
a(9) =
input('x1 = ');
a(10) =
input('x2 = ');
a(11) =
input('y1 = ');
a(12) =
input('y2 = ');
a(13) =
input('z1 = ');
a(14) =
input('z2 = ');
display('#
Pls input the initial point: #')
x0 =
zeros(3);
x0(1) =
input('x = ');
x0(2) =
input('y = ');
x0(3) =
input('z= ');
options =
optimset('Display','iter'); % Option to display output
[x,fval] =
fsolve(@(x) myfun(x,a),x0,options)
# Pls input
the known parameters: #
F= 496.7330165
T=
-0.004422825
Vx1 =
-0.017463
Vx2 =
-8.433214
Vy1=
-1.061177
Vy2= 4.465864
Vz1=
-0.147952
Vz2 =
96.778425
x1 =
-18129715.71
x2 =
-6317131.997
y1 =
38064542.4
y2 =
41568346.16
z1 =
20260.435
z2 =
-3071223.423
# Pls input
the initial point: #
x = -2000000
y = 4000000
z= -1000000
未定义与 'double' 类型的输入参数相对应的函数'myfun'.
出错 @(x)myfun(x,a)
出错 fsolve (line 217)
fuser =
feval(funfcn{3},x,varargin{:});
原因:
Failure in initial user-supplied objective
function evaluation. FSOLVE cannot continue.
fsolve(@myfun,x0,options)
求matlab大神帮忙看一下程序,程序的目的是求解多元非线性方程组
牛顿法求解非线性方程组 matlab编程 以下是我写的程序,但是有错误.
急求MATLAB解非线性方程组的程序
求高手帮忙看一下Matlab求积分的程序,
用lingo或者matlab解多元非线性方程组 比较着急 最好是把具体程序也附上 非常感谢啦
求大神将一下表达式用matlab程序求解
求Matlab高手帮我解答!我用fsolve函数求解非线性方程组,但是方程组中的系数我是通过另一个程序求出的,
matlab编写非线性方程组求根的二分法程序
利用matlab编写非线性方程组求根的二分法程序
求大神看一下这个程序是怎么排序的
帮忙看一下这段MATLAB程序 .
Matlab新手程序求大神帮忙?