필터 지우기
필터 지우기

How can I plot multiple signals with unit step signal

조회 수: 3 (최근 30일)
Aous Younis
Aous Younis 2013년 11월 15일
댓글: Aous Younis 2013년 11월 15일
I need to plot this function:
v(t)=(2t+1)[u(t)-u(t-1)]+3[u(t-1)-u(t-2)]+(-t+3)[u(t-2)-u(t-3)]

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 11월 15일
t=-5:0.1:5
v=(2*t+1).*(heaviside(t)-heaviside(t-1))+3*(heaviside(t-1)-heaviside(t-2))+(-t+3).*(heaviside(t-2)-heaviside(t-3))
plot(t,v,'linewidth',4)

추가 답변 (1개)

Wayne King
Wayne King 2013년 11월 15일
편집: Wayne King 2013년 11월 15일
Looks to me like this just simplifies to:
\delta(t) +3\delta(t-1) + \delta(t-2)
N = 128;
sig = zeros(N,1);
idx = 1:3;
sig(idx) = [1 3 1];
stem(sig)
u(t)-u(t-1) is like the derivative of the unit step at t, which is the delta function (distribution)
You can see it's equal if you implement your equation above using the differences of the translated unit step functions:
stepfunc = ones(128,4);
stepfunc(1,2) = 0;
stepfunc(1:2,3) = 0;
stepfunc(1:3,4) = 0;
t = (0:127)';
v1 = 2*t+1;
v2 = -t+3;
v = v1.*(stepfunc(:,1)-stepfunc(:,2))+ 3*(stepfunc(:,2)-stepfunc(:,3))+...
v2.*(stepfunc(:,3)-stepfunc(:,4));
subplot(211)
stem(v)
subplot(212)
stem(sig)
  댓글 수: 2
Azzi Abdelmalek
Azzi Abdelmalek 2013년 11월 15일
From his post, the signal u seems to be continuous
Aous Younis
Aous Younis 2013년 11월 15일
Thanks for ur help...but the signal is continuous

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

카테고리

Help CenterFile Exchange에서 Matched Filter and Ambiguity Function에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by