Graphing using linspace command

6 ビュー (過去 30 日間)
MGH
MGH 2018 年 1 月 30 日
回答済み: Star Strider 2018 年 1 月 30 日
I am trying to graph the function y = t^2 * exp(-t/2) * sin(4*t) where t is user input. I do not need help making a graph, but I cannot get y to be a matrix. Please advise.

回答 (1 件)

Star Strider
Star Strider 2018 年 1 月 30 日
I would do something like this:
endtc = inputdlg('Maximum time for the simulation ');
endt = str2double(endtc{:});
t = linspace(0, endt, endt*10);
y = t.^2 .* exp(-t/2) .* sin(4*t); % Use Element-Wise Operations
Experiment to get the result you want.

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by