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 ビュー (過去 30 日間)
  3 件のコメント
Sofie Önnemar
Sofie Önnemar 2020 年 9 月 25 日
I´m new to App Designer and not really sure where to start, with creating the code for each Radio Button.

サインインしてコメントする。

回答 (1 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2020 年 9 月 25 日
編集済み: KALYAN ACHARJYA 2020 年 9 月 25 日
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

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by