How to plot this function?

조회 수: 5 (최근 30일)
qpei9f dkaslfjl
qpei9f dkaslfjl 2017년 1월 28일
댓글: Star Strider 2017년 1월 30일
(exp(-t)*(exp(-1)^floor(-t) - 1))/(exp(1) - 1)

답변 (2개)

Star Strider
Star Strider 2017년 1월 28일
It’s straightforward:
t = linspace(0, 99);
f = @(t) (exp(-t).*(exp(-floor(-t)) - 1))/(exp(1) - 1);
figure(1)
plot(t, f(t), '-pg')
grid
See the documentation for the plot function, and Function Basics (link) to understand the anonymous function.
  댓글 수: 4
qpei9f dkaslfjl
qpei9f dkaslfjl 2017년 1월 30일
Again, thanks a lot.
Star Strider
Star Strider 2017년 1월 30일
My pleasure.

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


Image Analyst
Image Analyst 2017년 1월 28일
Try this:
t = linspace(-4, 15, 1000);
y = (exp(-t) .* (exp(-1) .^ floor(-t) - 1)) ./ (exp(1) - 1);
plot(t, y, 'LineWidth', 2);
grid on;
fontSize = 20;
xlabel('t', 'FontSize', fontSize);
ylabel('y', 'FontSize', fontSize);
ax = gca
ax.YAxisLocation = 'origin'
ax.XAxisLocation = 'origin'
  댓글 수: 1
qpei9f dkaslfjl
qpei9f dkaslfjl 2017년 1월 28일
Thanks a lot. Seems it is periodic as I hoped.

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by