how to plot v-t graph for v=v0(e^-kt)?

7 views (last 30 days)
현규 강
현규 강 on 10 Mar 2022
Edited: Sam Chak on 10 Mar 2022
how to set variables for v0 and k?

Answers (2)

Davide Masiello
Davide Masiello on 10 Mar 2022
Try this
clear,clc
v0 = 1;
k = 1;
t = linspace(0,10,100);
v = v0*exp(-k*t);
figure
plot(t,v)

Sam Chak
Sam Chak on 10 Mar 2022
Edited: Sam Chak on 10 Mar 2022
The method posted by @Davide Masiello is proper. Alternatively, if you want a quick plot to view, then you can do this:
v0 = 3; % initial value
k = 2; % inverse of time constant (tau = 0.5), that's why it converges at 5*tau = 2.5 sec
fplot(@(t) v0*exp(-k*t), [0 5]);

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!