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
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
3 Commenti
Risposte (1)
KALYAN ACHARJYA
il 25 Set 2020
Modificato: KALYAN ACHARJYA
il 25 Set 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
Vedere anche
Categorie
Scopri di più su Interactive Control and Callbacks in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!