필터 지우기
필터 지우기

Hello all please help me to plot this function

조회 수: 3 (최근 30일)
Ted Erdenekhuyag
Ted Erdenekhuyag 2022년 12월 2일
댓글: Ted Erdenekhuyag 2022년 12월 2일
number=0;
m=4
for t=1:50
x(i,1)=rand(1,1)<=0.5
if symsum(x(i,1),i,t-m+1,t)=m&&x(t-1)=0
x(t,1)= 1
else
symsum(x(i,1),i,t-m+1,t)=0&&x(t-1)=1
x(t,1)= 0
end
end
figure,stem(1:50,x)
xlabel('t')
ylabel('x(t)')
  댓글 수: 2
David Hill
David Hill 2022년 12월 2일
You need to define the past. When t=1 your are looking back to x(-2),x(-1),and x(0). These initial values need to be defined.
Ted Erdenekhuyag
Ted Erdenekhuyag 2022년 12월 2일
Sir, x(t) is bernoulli random variable

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

답변 (1개)

VBBV
VBBV 2022년 12월 2일
편집: VBBV 2022년 12월 2일
The conditions seem wierd, considering random number series .as inputs
m=4
m = 4
syms i;
% t = 50;
for t=2:50
x(t)=randi([0 4],1);
if double(symsum(x,i,t-m+1,t))== m & x(t-1)==0
x(t)= 1;
elseif double(symsum(x,i,t-m+1,t))==0 & x(t-1)==1
x(t)= 0;
end
end
figure,stem(1:50,x)
xlabel('t')
ylabel('x(t)')
  댓글 수: 2
Ted Erdenekhuyag
Ted Erdenekhuyag 2022년 12월 2일
Brother the result should be like this when i apply m=4 consecutive samples where x(t)=1 total number of this less than m should be eliminated plus x(t) only take two values 0(alarm deactivated) or 1 (alarm activated) how can i do this on matlab.
Ted Erdenekhuyag
Ted Erdenekhuyag 2022년 12월 2일
i want to eliminate those whose total consecutive 1's are less than 4

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

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by