# Symbolic expression for exponential decay

조회 수: 3 (최근 30일)
L'O.G. 2022년 7월 10일
댓글: Voss 2022년 7월 11일
To calculate an exponential decay with a single constant τ, , why do you need to multiply the following by a heaviside function as below if you want a symbolic expression? Also, how would you do this for multiple constants, i.e., given a vector of the constants?
syms t real
tau = 0.1;
f(t) = exp(-t/tau)*heaviside(t);
I am referring to the answer here.

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

### 채택된 답변

Voss 2022년 7월 10일
exp(-t/tau) is an exponential function of t, whose value is 1 at t = 0, whose value is less than 1 for t > 0, and whose value is greater than 1 for t < 0.
Here's a plot of exp(-t/tau) without the heaviside(t):
syms t real
tau = 0.1;
f(t) = exp(-t/tau);
fplot(f,[-1 1])
Notice the very large values f(t) has when t < 0.
Look at those same values on a log scale:
fplot(f,[-1 1])
set(gca(),'YScale','log')
Notice the function goes through 1 at t = 0.
In order to have the function start at t = 0 and discard the values for t < 0, you can use the heaviside() function, which has value 1 for t > 0 and value 0 for t < 0 (its value is 1/2 at t = 0):
fplot(heaviside(t),[-1 1],'LineWidth',2)
Multiplying exp(-t/tau) by heaviside(t) has the effect of zeroing-out the function for t < 0:
f(t) = exp(-t/tau)*heaviside(t);
fplot(f,[-1 1])
##### 댓글 수: 5이전 댓글 3개 표시이전 댓글 3개 숨기기
L'O.G. 2022년 7월 11일
@Paul @Voss Thank you both very much.
Voss 2022년 7월 11일
You're welcome!

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

### 카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

R2021b

### Community Treasure Hunt

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

Start Hunting!

Translated by