Trying to create a button that Calculates and displays both sine and cosine of the angle. in app designer
4 views (last 30 days)
Show older comments
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
1 Comment
Answers (0)
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!