How to plot this function?

5 visualizzazioni (ultimi 30 giorni)
qpei9f dkaslfjl
qpei9f dkaslfjl il 28 Gen 2017
Commentato: Star Strider il 30 Gen 2017
(exp(-t)*(exp(-1)^floor(-t) - 1))/(exp(1) - 1)

Risposte (2)

Star Strider
Star Strider il 28 Gen 2017
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 Commenti
qpei9f dkaslfjl
qpei9f dkaslfjl il 30 Gen 2017
Again, thanks a lot.
Star Strider
Star Strider il 30 Gen 2017
My pleasure.

Accedi per commentare.


Image Analyst
Image Analyst il 28 Gen 2017
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 Commento
qpei9f dkaslfjl
qpei9f dkaslfjl il 28 Gen 2017
Thanks a lot. Seems it is periodic as I hoped.

Accedi per commentare.

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by