필터 지우기
필터 지우기

To catch correct jump and store the number

조회 수: 2 (최근 30일)
suman Dhamala
suman Dhamala 2018년 2월 20일
편집: suman Dhamala 2018년 2월 21일
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
Star Strider
Star Strider 2018년 2월 20일
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 2018년 2월 20일
The code is very simple. I am not getting an idea to use two if loop in a correct way I guess

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Physical Units에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by