フィルターのクリア

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 Center および File ExchangePhysical Units についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by