필터 지우기
필터 지우기

I need help graphing a function.

조회 수: 2 (최근 30일)
Brendan
Brendan 2023년 9월 27일
댓글: Star Strider 2023년 9월 27일
The code creates a graph but I'm pretty sure it's wrong because It's supposed to look closer to a cos(x) graph
t=linspace(0,100,101);
y=(3.*((2.71828).^(-t./2))).*(cos(4.*pi.*t));
plot(t,y);
grid

채택된 답변

Star Strider
Star Strider 2023년 9월 27일
It probably should be a decaying sinusoid.
The problem is that it decays too fast. Decreasing the magnitude of ‘t’ helps to visualise it correctly. (I suspect the problem is the ‘exp(-t./2)’ term. The constant should be smaller than 0.5 to get the result you lilely want with the original ‘t’.)
t=linspace(0,100,101)/10;
y = 3.*exp(-t./2).*cos(4.*pi.*t);
plot(t,y);
grid
.
  댓글 수: 2
Brendan
Brendan 2023년 9월 27일
Thank you. That is exactly what i was looking for.
Star Strider
Star Strider 2023년 9월 27일
As always, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Directed Graphs에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by