How to plot a 3D graphic with app designer ?

조회 수: 10 (최근 30일)
Charline GARCELON
Charline GARCELON 2018년 5월 27일
편집: David 2023년 9월 4일
Among the components we can choose in App designer, I only find 1D or 2D axes graphic. However, Matlab suggests we can plot in 3D with this assistant (my version is 2017b). Please tell me how ;) Have a nice day!

답변 (2개)

Chris Portal
Chris Portal 2018년 5월 31일
You can do this by calling your 3D plotting function and passing in the handle to your app axes:
[X,Y] = meshgrid(1:0.5:10,1:20);
Z = sin(X) + cos(Y);
surf(app.UIAxes, X,Y,Z)

Alpay Karadag
Alpay Karadag 2019년 12월 23일
편집: David 2023년 9월 4일
function projmotion(x0,y0,v0,theta)
g = 9.8;
theta=45;
alpha=80;
v0=100;
y0=50;
x0=50;
z0=20;
xc=795;
yc=235;
zc=215;
rc=10;
for k1=1:360
gama=pi*k1/180;
xc1(k1)=10*cos(gama)+xc;
yc1(k1)=10*sin(gama)+yc;
zc1(k1)=zc;
end
figure(app.UIAxes,'Color', [1 1 1]);
h=plot3(app.UIAxes,xc1,yc1,zc1,'.');
set(app.UIAxes,h,'Color',[0.2,0.3,1]);
hold(app.UIAxes,"on")
angle = theta*(pi./180);
hangtime = 2.04*v0*sin(angle)/g;
t = hangtime;
if theta >90
maxheight = y0 + (v0)^2./(2*g)
xheight = x0 + v0*(t/2);
minheight = 0
error('Please select angle value of 90 degrees or less')
end;
for k=0:t/500:t
x = x0 +(v0*k)*cos(angle)*sin(pi*alpha/180);
y = y0 +(v0*k)*cos(pi*alpha/180);
z = z0 +(v0*k)*sin(angle)-0.5*g*(k^2);
h = plot3(app.UIAxes,x,y,z,'.');
set(app.UIAxes,h,'Color',[1,0.3,0.5]);
grid(app.UIAxes,"on")
hold(app.UIAxes,"on")
pause(0.02);
end
end
GUYS WE CARRY ON APP DESIGNER FROM EDIT WINDOW BUT WE DONT TAKE ANY RESULTS :/

카테고리

Help CenterFile Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by