Advertisement
wendy890711

navigationcacode

Oct 31st, 2020 (edited)
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. clc
  2. x = [ 1 1 1 1 1];
  3. s=50;
  4. for n = 1:s
  5. A = x(1,3);
  6. B = x(1,5) ;
  7. xor(A,B);
  8. C=xor(A,B);
  9. output = x(1,5);
  10. x(1,5)=x(1,4);
  11. x(1,4)=x(1,3);
  12. x(1,3)=x(1,2);
  13. x(1,2)=x(1,1);
  14. x(1,1)=C;
  15. fprintf('第%d個output為%d\n',n,output);
  16. x
  17. end
  18. x = [ 1 1 1 1 1];
  19. for n = 1:s
  20. A = x(1,3);
  21. B = x(1,5) ;
  22. xor(A,B);
  23. C=xor(A,B);
  24. output = x(1,5);
  25. x(1,5)=x(1,4);
  26. x(1,4)=x(1,3);
  27. x(1,3)=x(1,2);
  28. x(1,2)=x(1,1);
  29. x(1,1)=C;
  30. if (n<=19) & (n>=10)
  31. fprintf('第%d個output為%d\n',n,output);
  32. end
  33. if(n==40)
  34. fprintf('\n');
  35. end
  36. if (n<=50) & (n>=41)
  37. fprintf('第%d個output為%d\n',n,output);
  38. end
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement