필터 지우기
필터 지우기

I need to reproduce the paper result

조회 수: 5 (최근 30일)
Ted Erdenekhuyag
Ted Erdenekhuyag 2022년 12월 2일
답변: Fifteen12 2022년 12월 2일
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

답변 (1개)

Fifteen12
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))
1
this assumes that x_a and x_a,m are the same list

카테고리

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