Azzera filtri
Azzera filtri

I am currently to plot in MATLAB App designer but only one figure gets plotted and the code for second figure gets ignored

2 visualizzazioni (ultimi 30 giorni)
This is what I get in out put but my code is this. (Please ignore the code just see that in code I have also used "plot(app,UIAxes2))" But still no plot for figure 2.
My app window is this
My code is following
L = app.LengthofSimulationSlider.Value; % Pendulum length in meters
Angle(1) = app.InitialAngleSlider.Value; % Initial Angle of Pendulum in Radians
g = 9.81; % Gravitational Acceleration
h = 0.04; % Step length for Time
Omega(1) = 0; % Initial value for Angular Velocity
time = app.LengthofSimulationSlider.Value; % Simulation for Seconds
Time = 0:h:time;
x_data(1)= L*sin(Angle(1)); % x-corodinate
y_data(1)= -L*cos(Angle(1)); % y-corodinate
for i = 2:length(Time)
Omega(i) = Omega(i-1) - h*g*sin(Angle(i-1))/L; % Equation 1 Solution
Angle(i) = Angle(i-1) + h*Omega(i); % Equation 2 Solution
x_data(i)= L*sin(Angle(i)); % x-corodinate
y_data(i)= -L*cos(Angle(i)); % y-corodinate
end
for j = 1:length(Angle)
% Plot on UIAxes
cla(app.UIAxes)
plot(app.UIAxes,Time,Angle,'k-','linew',1.5)
hold(app.UIAxes,'on')
plot(app.UIAxes,Time(j),Angle(j),'ro','markersize',5,'markerfacecolor','r')
axis(app.UIAxes,[Time(1) Time(end) -3 3])
% Plot on UIAxes2
cla(app.UIAxes2)
plot(app.UIAxes2,1:10,2:11,'b','linew',3);
hold(app.UIAxes2,'on')
plot(app.UIAxes2,[0 0],[0 0],'bo','markersize',7,'markerfacecolor','b')
plot(app.UIAxes2,[0 x_data(j)],[0 y_data(j)],'r-','linew',2,'markerfacecolor','r')
plot(app.UIAxes2,[0 x_data(j)],[0 y_data(j)],'bo','markersize',7,'markerfacecolor','b')
axis(app.UIAxes2,'equal')
axis(app.UIAxes2,[-L-1 L+1 -3 3])
pause(0.00005)
end
please helpppp !!!!!!!!!!!
If you dont understand anything just ask but please help It wont take any more than 5 seconds for expertsss
  3 Commenti
Bora Eryilmaz
Bora Eryilmaz il 7 Dic 2022
Looks like you might have placed the second UIAxes outside the boundary of the App. Move it up near the other axes.
Haseeb Hashim
Haseeb Hashim il 7 Dic 2022
Many thanks to you guys. I was stuck here from a long time. Many Many thanks again..........
MATLAB would be a nightmare for us amateurs without you guyz.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Develop Apps Using App Designer in Help Center e File Exchange

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by