Hello,
I have two arrays containing 0's & 1's. I want to find xor of the two arrays with two additional conditions:
- The xor has to be done only in the case of rising edges.
- To distinguish which array is having rising edge first, I have assigned outputs as 3 levels i.e. 1, 0, -1
Considering an example, if 'a' and 'b' are input arrays and PWM3 is the output array;
a = [0,1,1,1,1,0,0,0,1,1,1,0,0,0,0,0,1]
b = [0,0,0,1,1,1,1,0,0,1,1,1,1,0,1,1,1]
So, the output has be ;
PWM3 = [0,1,1,0,0,0,0,0,1,0,0,0,0,0,-1,-1,0] , so if 'a' has rising edge first output is '1', if 'b' has rising edge first output is '-1', else the output is '0'.
I am trying as given below, but I can't figure out how to take into consideration rising edges only. If someone has any idea about it, please let me know.
Thanks
for p= 1:length(a)if(a(p)== 1 && b(p)== 0)PWM3(p) = 1;elseif (a(p)== 0 && b(p)== 1)PWM3(p) = -1;elsePWM3(p) = 0;endend
Best Answer