首页 > 编程知识 正文

matlab绘图坐标轴设置,matlab绘图坐标xy反了

时间:2023-05-05 12:56:39 阅读:174174 作者:2857

我现在生产的东西我很高兴得益于提供给我的有用答案。我确实使用了稍微不同的方法绘制弧线。

hold on

r =1;

phi = pi/4;

theta = pi/4;

%% plot cartesian coordinates:

x0=0;

y0=0;

z0=0;

plot3(x0+[0, .8, nan, 0, 0, nan, 0, 0], y0+[0, 0, nan, 0, .8, nan, 0, 0], z0+[0, 0, nan, 0, 0, nan, 0, .8],'k')

text([x0+.85, x0, x0], [y0, y0+.8, y0], [z0, z0, z0+.85], ['$x$';'$y$';'$z$'],'FontSize',14, 'Interpreter','latex');

%% plot the ball

line('xdata',sphcart(r,theta,phi,'x'),'ydata',sphcart(r,theta,phi,'y'),'zdata',sphcart(r,theta,phi,'z'),'marker','.','markersize',5);

%% Plot the arm

line('xdata',[0 sphcart(r,theta,phi,'x')],'ydata',[0 sphcart(r,theta,phi,'y')],'zdata',[0 sphcart(r,theta,phi,'z')]);

%% Plot the projections

line('xdata',[0 sphcart(r,theta,phi,'x')],'ydata',[0 sphcart(r,theta,phi,'y')],'zdata',[0 0],'linestyle','--');

%% Line from xy plane to point

line('xdata',[sphcart(r,theta,phi,'x') sphcart(r,theta,phi,'x')],'ydata',[sphcart(r,theta,phi,'y') sphcart(r,theta,phi,'y')],'zdata',[0 sphcart(r,theta,phi,'z')],'linestyle','--')

%% label r

text(.5,.5,.8,'$r$','FontSize',14, 'Interpreter','latex')

%% change view point

az = 100;

el = 45;

view(az,el)

%% get rid of axis labels

set(gca, 'XTick', yjdl, 'YTick', yjdl, 'ZTick', yjdl)

set(gca, 'xcolor', 'w', 'ycolor', 'w','zcolor', 'w') ;

%% arc (xy)

theta = [0: pi/4*0.0001 :pi/4];

phi = linspace(0,0,10001);

r = linspace(0.25,0.25,10001);

plot3(X,Y,Z,'Color','k');

% label arc

text(.3,0.08,0,'$theta$','FontSize',14,'Interpreter','latex')

%% arc down from z

phi = [pi/4: pi/4*0.0001 :pi/2];

theta = linspace(pi/4,pi/4,10001);

r = linspace(0.25,0.25,10001);

plot3(X,Y,Z,'Color','k');

% label arc

text(.1,.08,0.4,'$phi$','FontSize',14,'Interpreter','latex')

这里的情节:

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。