So I've been trying to plot this function as y achses and time t as x achses
t = 0 : 1/100 : 2*pi
u = 300*((exp(-t/(68.2128*10^-6))-(exp(-t/(405*10^-9)))))
but it doesn't seem to give me the correct answer. How can i convert the equation into a code?

 Accepted Answer

I think your expression for u is ok (but note that 68.2128*10^-6 can be written more compactly as 68.2128e-6, etc., which allows you to use fewer parentheses). The only problem is the choice of t over which to calculate u.
t = 0 : 1e-6 : 4e-4;
u = 300*(exp(-t/68.2128e-6)-exp(-t/405e-9));
plot(t,u)

2 Comments

Perfect! it worked. Thanks!
A good way to thank is to click the "Accept this answer" link to award the answerer with "Reputation points." Thanks in advance. 🙂

Sign in to comment.

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Asked:

on 1 May 2022

Commented:

on 1 May 2022

Community Treasure Hunt

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

Start Hunting!