How to plot a 3D graphic with app designer ?

48 ビュー (過去 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 Center および File ExchangeCreating, 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