Trying to plot the cosine of an angle in app designer
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I'm trying to create a button that displays values in two text boxs and plots two seperate graphs in the app designer so far the code I have is below. The program doesn't react when the button is pressed.
% Button pushed function: PlotSinCosButton
function PlotSinCosButtonPushed(app, event)
degrees = app.EnterDegreesEditField.Value;
% creates the variable for degrees.
radians = degrees.*pi./180;
% Converts degrees to radians.
yc = cos(radians);
ys = sin(radians);
plot(app.UIAxes,yc);
plot(app.UIAxes_2,ys);
yc = app.CosineoftheangleEditField.Value;
ys = app.SineoftheangleEditField.Value;
end
0 comentarios
Respuestas (1)
Ameer Hamza
el 21 de Mayo de 2020
Editada: Ameer Hamza
el 21 de Mayo de 2020
From your code, it appears that 'degrees' is a scalar
degrees = app.EnterDegreesEditField.Value;
so you are just trying to plot a single point. By default, it will not be visible on the axes. Change your lines to this
plot(app.UIAxes, yc, '+');
plot(app.UIAxes_2, ys, '+');
0 comentarios
Ver también
Categorías
Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!