matlab中如何通过下式画三维散点图的函数?E=50;x=[];y=[];z=[];n=1;x(1)=0.4;y(1)=0.3; z(1)=0;while E>=0.1&z(n)>=0fai=2*pi*rand;Theta=2*pi*rand;Q(n)=[-sin(fai),-cos(Theta)*cos(fai),sin(Theta)*cos(fai);cos(fai),-cos(Theta)*sin(fai),sin(Thet
来源:学生作业帮助网 编辑:六六作业网 时间:2025/01/22 21:10:52
matlab中如何通过下式画三维散点图的函数?E=50;x=[];y=[];z=[];n=1;x(1)=0.4;y(1)=0.3; z(1)=0;while E>=0.1&z(n)>=0fai=2*pi*rand;Theta=2*pi*rand;Q(n)=[-sin(fai),-cos(Theta)*cos(fai),sin(Theta)*cos(fai);cos(fai),-cos(Theta)*sin(fai),sin(Thet
matlab中如何通过下式画三维散点图的函数?
E=50;
x=[];
y=[];
z=[];
n=1;
x(1)=0.4;
y(1)=0.3;
z(1)=0;
while E>=0.1&z(n)>=0
fai=2*pi*rand;
Theta=2*pi*rand;
Q(n)=[-sin(fai),-cos(Theta)*cos(fai),sin(Theta)*cos(fai);cos(fai),-cos(Theta)*sin(fai),sin(Theta)*sin(fai);0,sin(Theta),cos(Theta)];
Deter(n)=[sin(Theta)*cos(fai);sin(Theta)*sin(fai);cos(Theta)];
P0=P0*Q(n);
M=P0*Deter(n);
n=n+1;
x(n)=x(n-1)+0.5*M(:,1);
y(n)=y(n-1)+0.5*M(:,2);
z(n)=z(n-1)+0.5*M(:,3);
E=E-2.5;
plot3(x,y,z,'r.')
end
怎么修改程序画出三维散点图啊?
P0的初值为三阶单位阵
matlab中如何通过下式画三维散点图的函数?E=50;x=[];y=[];z=[];n=1;x(1)=0.4;y(1)=0.3; z(1)=0;while E>=0.1&z(n)>=0fai=2*pi*rand;Theta=2*pi*rand;Q(n)=[-sin(fai),-cos(Theta)*cos(fai),sin(Theta)*cos(fai);cos(fai),-cos(Theta)*sin(fai),sin(Thet
E=50;
x=[];
y=[];
z=[];
n=1;
x(1)=0.4;
y(1)=0.3;
z(1)=0;
while E>=0.1&&z(n)>=0
fai=2*pi*rand;
Theta=2*pi*rand;
Q=[-sin(fai),-cos(Theta)*cos(fai),sin(Theta)*cos(fai);cos(fai),-cos(Theta)*sin(fai),sin(Theta)*sin(fai);0,sin(Theta),cos(Theta)];
Deter=[sin(Theta)*cos(fai);sin(Theta)*sin(fai);cos(Theta)];
M=Q*Deter;
n=n+1;
x(n)=x(n-1)+0.5*M(1);
y(n)=y(n-1)+0.5*M(2);
z(n)=z(n-1)+0.5*M(3);
E=E-2.5;
end
plot3(x,y,z,'r.')