Plotting in 3d

1 view (last 30 days)
Philosophaie
Philosophaie on 9 Oct 2017
Answered: KSSV on 10 Oct 2017
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;

Answers (1)

KSSV
KSSV on 10 Oct 2017
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.

Categories

Find more on Argument Definitions in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!