Borrar filtros
Borrar filtros

To catch correct jump and store the number

2 visualizaciones (últimos 30 días)
suman Dhamala
suman Dhamala el 20 de Feb. de 2018
Editada: suman Dhamala el 21 de Feb. de 2018
Hi I want to record the up and down count of the signal when it satisfies my threshold condition but the code is not working. I need to catch the jumps shown by red in the image. I have attached the image as well as my code so can anyone solve it sooner. Thank you for your help!
phi(1)=0.66702; phi(2)= 0.667003; phidc(1)=0;phidc(2)= 0.00001;
for n=2:10^5 ;
p= 0.5.*rand-0.25; q = 1.*rand -0.5 ;
phi(n+1)= 0.0031+ 1.9676*phi(n) -0.9686*phi(n-1)- 0.0039*cos( 0.5*phidc(n))* sin(phi(n)) + 0.0390* q ;
phidc(n+1)= 1.8873*phidc(n) -0.9686*phidc(n-1)- 0.0079*sin(0.5*phidc(n))* cos(phi(n)) + 4*0.0390* p ;
if phi(n+1)> 4.5 && phi(n)< 4.5 ;
count1= count1+1 ;
UP(count1)= n;
if phi(n+1)< 1.5 && phi(n)> 1.5 ;
count0= count0+1 ;
DOWN(count0)= n;
end
end
end
  4 comentarios
Star Strider
Star Strider el 20 de Feb. de 2018
You will likely have to do that in hardware, for example with a Schmitt trigger (link).
It might be possible to do that in real-time. I have no real-time Toolboxes, so I have no experience with that.
suman Dhamala
suman Dhamala el 20 de Feb. de 2018
The code is very simple. I am not getting an idea to use two if loop in a correct way I guess

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Physical Units en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by