I need to reproduce the paper result

1 visualización (últimos 30 días)
Ted Erdenekhuyag
Ted Erdenekhuyag el 2 de Dic. de 2022
Respondida: Fifteen12 el 2 de Dic. de 2022
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

Respuestas (1)

Fifteen12
Fifteen12 el 2 de Dic. de 2022
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

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by