Trying to create a button that Calculates and displays both sine and cosine of the angle. in app designer

3 vues (au cours des 30 derniers jours)
I'm trying to use the yc and ys fuctions to create a plot and display they're values in a text box.
% Button pushed function: ConfirmtheanswerButton
function ConfirmtheanswerButtonPushed(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);
c = yc.^2 + ys.^2;
% Confirms that the radians from degrees conversion is correct
app.ConfirmationoftheanswerEditField.Value = c;
% sets the variable for the formula.
end
% 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.ValueDisplayFormat;
ys = app.SineoftheangleEditField.Value;
end
end

Réponses (0)

Catégories

En savoir plus sur Dates and Time dans Help Center et File Exchange

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by