I need to reproduce the paper result
조회 수: 1 (최근 30일)
이전 댓글 표시
when i apply m=4 delay timer consecutive samples less than 4 should be eliminated how to do that on matlab x(t) is actually random variable only takes 1(when alarm raises) 0 (when alarm clears)
this is what on the the paper
syms i;
t = 3:50;
for t=3:50
x(t)=rand(1,1)<=0.5;
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(t,x(t))
xlabel('t')
ylabel('x(t)') this is the code i have trying to write but not complete
댓글 수: 0
답변 (1개)
Fifteen12
2022년 12월 2일
I'm not sure what the difference between x_a and x_a,m is, but maybe this would work:
x = [1, 1, 1, 1, 1, 0];
m = 4;
t = 6;
sum_x = sum(x(max(0,t-m+1):t));
if sum_x == m && x(t-1) == 0
x(t) = 1;
elseif sum_x == m && x(t-1) == 1
x(t) = 0;
else
x(t) = x(t-1);
end
disp(x(t))
this assumes that x_a and x_a,m are the same list
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Mathematics and Optimization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!