how to do decisions and compare events at fixed repeatative time span of 0 to 0.02 seconds
    5 views (last 30 days)
  
       Show older comments
    
hi
i have a periodic time span of 0 to 0.02 seconds (50 hz signal). now in that fixed repetitive and accurate duration i want to do decisions like defined below. i have create the logic but i am unable to program it. kindly help me i will be highly thankful to you.
with best regards
mudasir
      angle1=0.000555555555555555556 seconds
      angle2=0.001666666666666666667 seconds
      angle3=0.003333333333333333333 seconds
      if (time>0 &&  time<=angle1)   
          S1=0; % states of gate pulses going to the hardware circuitry
          S2=1;
          S3=0;
          S4=1;
          S5=0;
          S6=1;
          S7=0;
          S8=1;
          S9=0;
          S10=1;
          S11=0;
          S12=1;
      else if (time>angle1 &&  time<=angle2)     
          S1=1;
          S2=1;
          S3=0;
          S4=0;
          S5=0;
          S6=1;
          S7=0;
          S8=1;
          S9=0;
          S10=1;
          S11=0;
          S12=1;
      else if (time>angle2 &&  time<=angle3)   
          S1=1;
          S2=1;
          S3=0;
          S4=0;
          S5=1;
          S6=1;
          S7=0;
          S8=0;
          S9=0;
          S10=1;
          S11=0;
          S12=1;
      else if (time>angle3 &&  time<=0.01-angle3)     
          S1=1;
          S2=1;
          S3=0;
          S4=0;
          S5=1;
          S6=1;
          S7=0;
          S8=0;
          S9=1;
          S10=1;
          S11=0;
          S12=0;
      else if (time>0.01-angle3 &&  time<=0.01-angle2)     
          S1=1;
          S2=1;
          S3=0;
          S4=0;
          S5=1;
          S6=1;
          S7=0;
          S8=0;
          S9=0;
          S10=1;
          S11=0;
          S12=1;
      else if (time>0.01-angle2 &&  time<=0.01-angle1)       
          S1=1;
          S2=1;
          S3=0;
          S4=0;
          S5=0;
          S6=1;
          S7=0;
          S8=1;
          S9=0;
          S10=1;
          S11=0;
          S12=1;
      else if (time>0.01-angle1 &&  time<=0.01+angle1)    
          S1=0;
          S2=1;
          S3=0;
          S4=1;
          S5=0;
          S6=1;
          S7=0;
          S8=1;
          S9=0;
          S10=1;
          S11=0;
          S12=1;
      else if (time>0.01+angle1 &&  time<=0.01+angle2)   
          S1=0;
          S2=0;
          S3=1;
          S4=1;
          S5=1;
          S6=0;
          S7=1;
          S8=0;
          S9=1;
          S10=0;
          S11=1;
          S12=0;
      else if (time>0.01+angle2 &&  time<=0.01+angle3)   
          S1=0;
          S2=0;
          S3=1;
          S4=1;
          S5=0;
          S6=0;
          S7=1;
          S8=1;
          S9=1;
          S10=0;
          S11=1;
          S12=0;
      else if (time>0.01+angle3 &&  time<=0.02-angle3)     
          S1=0;
          S2=0;
          S3=1;
          S4=1;
          S5=0;
          S6=0;
          S7=1;
          S8=1;
          S9=0;
          S10=0;
          S11=1;
          S12=1;
      else if (time>0.02-angle3 &&  time<=0.02-angle2)   
          S1=0;
          S2=0;
          S3=1;
          S4=1;
          S5=0;
          S6=0;
          S7=1;
          S8=1;
          S9=1;
          S10=0;
          S11=1;
          S12=0;
      else if(time>0.02-angle2 &&  time<=0.02-angle1)   
          S1=0;
          S2=0;
          S3=1;
          S4=1;
          S5=1;
          S6=0;
          S7=1;
          S8=0;
          S9=1;
          S10=0;
          S11=1;
          S12=0;
      else 
          S1=0;
          S2=1;
          S3=0;
          S4=1;
          S5=0;
          S6=1;
          S7=0;
          S8=1;
          S9=0;
          S10=1;
          S11=0;
          S12=1;
there is also a second logic, generate 50Hz signal and measure degree of each and every instant of that and do decisions like above, by changinging only
      0.01 seconds=180 degree
      0.02 seconds=360 degree
      angle1=10 degree      as 1 degree=0.02/360
      angle2=30 degree
      angle3=60 degree
both logic's can be implemented but how?.
kindly help me
0 Comments
Answers (0)
See Also
Categories
				Find more on Numeric Types in Help Center and File Exchange
			
	Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!