Advertisement
milenkorz

20190510_01

May 10th, 2019
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. coordinates = Get@"https://pastebin.com/raw/0t1MBAgX";
  2.  
  3. scaleX = 1.418*10^-2;
  4. scaleZ = 1.425*10^-2;
  5.  
  6. {lX, lZ} = {1600, 1200};
  7.  
  8. kX = 2*Pi/(lX*scaleX)*(Range[lX] - lX/2) // N;
  9. kZ = 2*Pi/(lZ*scaleZ)*(Range[lZ] - lZ/2) // N;
  10.  
  11. cx = Flatten[coordinates[[All, 1]]];
  12. cy = Flatten[coordinates[[All, 2]]];
  13.  
  14. rX = Flatten@Outer[Differences[{##}] &, cx, cx];
  15. rZ = Flatten@Outer[Differences[{##}] &, cy, cy];
  16.  
  17. nP = Length[coordinates];
  18.  
  19. s = Array[0 &, {lZ, lX}];
  20.  
  21. Do[
  22. Do[
  23. s[[j, i]] = 1/nP*Total[Cos[kX[[i]]*rX + kZ[[j]]*rZ]]
  24. , {i, 1, lX}
  25. ]
  26. , {j, 1, lZ}
  27. ]; // AbsoluteTiming
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement