Create an app in MATLAB App Designer. Use a RadioButton Group to choose the different functions. When you choose one function it should be displayed in a graph in the app and the title should state which graph it is. the functions are sine,cosine,lnx

9 vues (au cours des 30 derniers jours)
  3 commentaires
Sofie Önnemar
Sofie Önnemar le 25 Sep 2020
I´m new to App Designer and not really sure where to start, with creating the code for each Radio Button.

Connectez-vous pour commenter.

Réponses (1)

KALYAN ACHARJYA
KALYAN ACHARJYA le 25 Sep 2020
Modifié(e) : KALYAN ACHARJYA le 25 Sep 2020
Steps: (Or Refer any tutorial, please check in the MATLAB youtube channel)
1. Open MATLAB
2. Type the following in the command window
>> appdesigner
2. Just drag and drop all required blocks, chahe the texts as per requirements
4. Call Back activate (Right Click on the Radio Button Group)
5. Insert the following code, its just the if else condition
6. Run the code
SteselectedButton = app.yButtonGroup.SelectedObject;
x=1:0.05:100;
if app.sinxButton.Value
y=sin(x);
plot(app.UIAxes,x,y);
title(app.UIAxes,'y=sin(x)');
elseif app.cosxButton.Value
y=cos(x);
plot(app.UIAxes,x,y);
title(app.UIAxes,'y=cos(x)');
elseif app.xButton.Value
y=2*x;
plot(app.UIAxes,x,y);
title(app.UIAxes,'y=2x');
elseif app.lnxButton.Value
y=log(x);
plot(app.UIAxes,x,y);
title(app.UIAxes,'y=ln(x)');
else
y=exp(x);
plot(app.UIAxes,x,y);
title(app.UIAxes,'y=e^x');
end

Catégories

En savoir plus sur Develop Apps Using App Designer dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by