How to plot a 3D graphic with app designer ?

114 views (last 30 days)
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!

Answers (2)

Chris Portal
Chris Portal on 31 May 2018
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 on 23 Dec 2019
Edited: Alpay Karadag on 23 Dec 2019
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 :/

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!