Graphing using linspace command

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일

0 개 추천

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.

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

질문:

MGH
2018년 1월 30일

답변:

2018년 1월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by