x(t) = t(u(t + 2) − 3 u(t − 3) + 2 u(t − 5))
How can I plot this function, with u as the diriac and t as a variable?

댓글 수: 2

Walter Roberson
Walter Roberson 2017년 3월 2일
It seems much more likely to me that you want Heaviside rather dirac.
Rik
Rik 2017년 3월 2일
I agree with Walter. If so, you could implement the Heaviside function (if there is not already an implementation built in) with something like (x+abs(x))/2

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

답변 (2개)

Walter Roberson
Walter Roberson 2017년 3월 2일

0 개 추천

heaviside exists in the Symbolic Math toolbox. Please be careful about the value of heavside(0); since R2015a you have been able to configure that value using sympref()
dirac exists in the Symbolic Math toolbox as well. Please remember that dirac() is technically a distribution, and that dirac(x) is 0 for all non-0 x and is infinite for x == 0, so multiplying dirac(x) by a constant only makes sense if you are integrating a function that contains dirac() (in which case you get the heaviside step function.)
Carlos M. Velez S.
Carlos M. Velez S. 2025년 7월 24일

0 개 추천

If you want to apply the Dirac delta function in simulation to continuous-time systems, the following code is enough:
function y = delta_dirac(u)
[n,m] = size(u);
if max(n,m) ==1
dt = 1e-6; % Define a small time increment for the delta function
else
dt = u(2) - u(1);
end
y = zeros(n,m);
for i=1:max(m,n)
if u(i) == 0
y(i) = 1/dt;
else
y(i) = 0;
end
end

카테고리

도움말 센터File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

질문:

2017년 3월 2일

답변:

2025년 7월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by