How to plot a 3D graphic with app designer ?

43 visualizzazioni (ultimi 30 giorni)
Charline GARCELON
Charline GARCELON il 27 Mag 2018
Modificato: David il 4 Set 2023
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!

Risposte (2)

Chris Portal
Chris Portal il 31 Mag 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 il 23 Dic 2019
Modificato: David il 4 Set 2023
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 :/

Categorie

Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by