Matlab,第十七行有Warning:Imaginary parts of complex X and/or Y arguments ignored如何改x=[4.5596 5.0816 5.5546 5.9636 6.2756]';y=[0.8145 1.3685 1.9895 2.6925 3.5265]';A=[x.^2 2*x.*y y.^2 2*x 2*y];w=[-1;-1;-1;-1;-1];w=A\w;C=[w(1) w(2);w(2) w(3)
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/26 03:31:13
Matlab,第十七行有Warning:Imaginary parts of complex X and/or Y arguments ignored如何改x=[4.5596 5.0816 5.5546 5.9636 6.2756]';y=[0.8145 1.3685 1.9895 2.6925 3.5265]';A=[x.^2 2*x.*y y.^2 2*x 2*y];w=[-1;-1;-1;-1;-1];w=A\w;C=[w(1) w(2);w(2) w(3)
Matlab,第十七行有Warning:Imaginary parts of complex X and/or Y arguments ignored如何改
x=[4.5596 5.0816 5.5546 5.9636 6.2756]';
y=[0.8145 1.3685 1.9895 2.6925 3.5265]';
A=[x.^2 2*x.*y y.^2 2*x 2*y];
w=[-1;-1;-1;-1;-1];
w=A\w;
C=[w(1) w(2);w(2) w(3)];
X=C\[-w(4);-w(5)];x0=X(1);y0=X(2);X=[X;1];
D=[w(1) w(2) w(4);w(2) w(3) w(5);w(4) w(5) 1];
f=X'*D*X;
[U d]=eig(C);
a=sqrt(-f/d(1,1));b=sqrt(-f/d(2,2));
t=0:1:2*pi+0.1;
u=a*cos(t);v=b*sin(t);
V=U*[u;v];
p0=U*[sqrt(a^2-b^2);0]+[x0;y0];x01=p0(1);y01=p0(2);
x1=V(1,:)+x0;y1=V(2,:)+y0;
plot(x1,y1,x,y,'*',x0,y0,'ko',x01,y01,'ko'),
n=length(t);s=1:n;si=1:.01:n;
x2=interp1(s,x1,si);x2=[x2,x2,x2];
y2=interp1(s,y1,si);y2=[y2,y2,y2];
comet(x2,y2)
Matlab,第十七行有Warning:Imaginary parts of complex X and/or Y arguments ignored如何改x=[4.5596 5.0816 5.5546 5.9636 6.2756]';y=[0.8145 1.3685 1.9895 2.6925 3.5265]';A=[x.^2 2*x.*y y.^2 2*x 2*y];w=[-1;-1;-1;-1;-1];w=A\w;C=[w(1) w(2);w(2) w(3)
p0 =
2.7213 - 2.4235i
2.4234 + 2.7213i
p0是复数 所以在绘图指令中被警告忽略了虚部!