Plotting in 3d

1 次查看(过去 30 天)
Philosophaie
Philosophaie 2017-10-9
回答: KSSV 2017-10-10
I cannot put all of the plot into one window. How do I plot in 3D?
v=3E8;
f=760E12;
x=zeros(400);
y=zeros(400);
z=zeros(400);
xx=zeros(400);
yy=zeros(400);
for tstep=1:360
t=tstep*1e-4;
x(tstep)=v*t;
y(tstep)=v/f*cos(tstep*pi/180);
z(tstep)=v/f*sin(tstep*pi/180);
xx(tstep)=(x(t)-y(t)*cos(45*pi/180));
yy(tstep)=z(t)-y(t)*sin(45*pi/180);
hold on;
plot(xx(tstep),yy(tstep),'-b');
end;
hold off;

回答(1 个)

KSSV
KSSV 2017-10-10
v=3E8;
f=760E12;
x=zeros(400);
y=zeros(400);
z=zeros(400);
xx=zeros(400);
yy=zeros(400);
for tstep=1:360
t=tstep*1e-4;
x=v*t;
y=v/f*cos(tstep*pi/180);
z=v/f*sin(tstep*pi/180);
xx(tstep)=(x-y*cos(45*pi/180));
yy(tstep)=z-y*sin(45*pi/180);
hold on;
plot(xx(tstep),yy(tstep),'.b');
end
hold off;
Can be achieved without loop also.

类别

Help CenterFile Exchange 中查找有关 Argument Definitions 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by