How to Plot 2D graph in GUI?

I have function f(X)=e.^-x sin(2*x) i can't draw the function by pressing the button can you help
% Button pushed function: Plot2DButton
function Plot2DButtonPushed(app, event)
Upper X = str2double(app.UpperXEditField.Value);
Lower X = str2double(app.LowerXEditField.Value);
x = linspace(LowerX, UpperX, 500);
y = x.^2; % Example function - change it according to your needs
plot(app.UIAxes2D, x, y);
end
end

1 件のコメント

Walter Roberson
Walter Roberson 2024 年 1 月 28 日
% Button pushed function: Plot2DButton
function Plot2DButtonPushed(app, event)
UpperX = str2double(app.UpperXEditField.Value);
LowerX = str2double(app.LowerXEditField.Value);
x = linspace(LowerX, UpperX, 500);
y = x.^2; % Example function - change it according to your needs
plot(app.UIAxes2D, x, y);
end
end

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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

タグ

質問済み:

2024 年 1 月 28 日

コメント済み:

2024 年 1 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by