global ax
divide=.2;
set(0,'units','pixels')
pixels=get(0,'screensize');
app.UIFigure.Position=[0,0,divide*pixels(3),pixels(4)];
fig=figure;
fig.Position=[divide*pixels(3),0,(1-divide)*pixels(3),pixels(4)];
ax=axes(fig);
function torsion(ax,ax2,M,G,L,r,display_in)
cla(ax)
J=1/4*r^4;
phi=M*L/(J*G);
n = 50;
r = [r r]';
r = r(:);
m = length(r); if m==1, r = [r;r]; m = 2; end
theta = (0:n)/n*2*pi;
sintheta = sin(theta); sintheta(n+1) = 0;
x = r * cos(theta);
y = r * sintheta;
z = (0:m-1)'/(m-1) *L* ones(1,n+1);
hold(ax,'on')
surf(ax,x,y,z,'EdgeColor','none','FaceAlpha',1)
patch(ax,x(1,:),y(1,:),z(1,:),[.25 0 .7])
patch(ax,x(1,:),y(1,:),z(2,:),[.25 0 .7])
z_vals=linspace(0,L,n*L/(2*pi*r(1)));
for i=0:n-1
angle0=i*(2*pi)/n;
anglef=angle0+phi;
theta_part=linspace(angle0,anglef,length(z_vals));
x_part=(r*1.01)*cos(theta_part);
y_part=(r*1.01)*sin(theta_part);
z_vals=linspace(0,L,length(x_part));
plot3(ax,x_part,y_part,z_vals,'k','LineWidth',.5)
end
for i=z_vals
plot3(ax,x,y,i*ones(1,n+1),'k','LineWidth',.5)
end
end
10 Comments
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/575107-app-slow-with-uiaxes#comment_961306
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/575107-app-slow-with-uiaxes#comment_961306
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/575107-app-slow-with-uiaxes#comment_961660
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/575107-app-slow-with-uiaxes#comment_961660
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/575107-app-slow-with-uiaxes#comment_962041
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/575107-app-slow-with-uiaxes#comment_962041
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/575107-app-slow-with-uiaxes#comment_962134
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/575107-app-slow-with-uiaxes#comment_962134
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/575107-app-slow-with-uiaxes#comment_962323
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/575107-app-slow-with-uiaxes#comment_962323
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/575107-app-slow-with-uiaxes#comment_962395
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/575107-app-slow-with-uiaxes#comment_962395
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/575107-app-slow-with-uiaxes#comment_962401
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/575107-app-slow-with-uiaxes#comment_962401
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/575107-app-slow-with-uiaxes#comment_962434
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/575107-app-slow-with-uiaxes#comment_962434
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/575107-app-slow-with-uiaxes#comment_962446
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/575107-app-slow-with-uiaxes#comment_962446
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/575107-app-slow-with-uiaxes#comment_962458
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/575107-app-slow-with-uiaxes#comment_962458
Sign in to comment.