MATLAB Answers

# 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 views (last 30 days)
Sofie Önnemar on 25 Sep 2020
Edited: KALYAN ACHARJYA on 25 Sep 2020

#### 3 Comments

Sofie Önnemar on 25 Sep 2020
the x-axis is between 1 and 100 with 0.5 spacing
KALYAN ACHARJYA on 25 Sep 2020
Any Issue?
Sofie Önnemar on 25 Sep 2020
I´m new to App Designer and not really sure where to start, with creating the code for each Radio Button.

Sign in to comment.

### Answers (1)

KALYAN ACHARJYA on 25 Sep 2020
Edited: KALYAN ACHARJYA on 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

#### 1 Comment

Sofie Önnemar on 25 Sep 2020
Thank you so so so much for the help!!

Sign in to comment.

### Community Treasure Hunt

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

Start Hunting!