file:   anal3_6het.m
author: Polcz Péter <ppolcz@gmail.com>
Created on 2016.09.30. Friday, 12:57:45
mlt = 5;
Nw = 31;
w = hamming(Nw);
w = w / sum(w);

N = 1000;
s = conv(rand(1,N)*100,w,'same').^2;
for i=1:mlt; s = conv(s,w,'same'); end

s = s(Nw*mlt:end-Nw*mlt).^2;
s = s - min(s);
s = s / max(s) + 0.1;

a = s(1);
b = s(2);

t = (0:numel(s)-1)/(numel(s)-1);
r = s + t*(-s(end)+s(1))+2;
theta = t*2*pi;

x = r.*cos(theta);
y = r.*sin(theta);

% plot(t,r,t,theta)
plot(x,y)
x = [ 2.712 , 2.709 , 2.707 , 2.704 , 2.702 , 2.699 , 2.696 , 2.693 , 2.690 , 2.686 , 2.682 , 2.677 , 2.673 , 2.668 , 2.662 , 2.656 , 2.650 , 2.644 , 2.637 , 2.630 , 2.622 , 2.615 , 2.607 , 2.599 , 2.591 , 2.583 , 2.574 , 2.565 , 2.557 , 2.548 , 2.539 , 2.530 , 2.521 , 2.512 , 2.502 , 2.493 , 2.483 , 2.473 , 2.463 , 2.453 , 2.442 , 2.432 , 2.421 , 2.410 , 2.399 , 2.387 , 2.376 , 2.365 , 2.353 , 2.341 , 2.330 , 2.318 , 2.306 , 2.294 , 2.283 , 2.271 , 2.260 , 2.248 , 2.236 , 2.225 , 2.213 , 2.201 , 2.188 , 2.176 , 2.163 , 2.150 , 2.136 , 2.121 , 2.106 , 2.090 , 2.073 , 2.055 , 2.036 , 2.016 , 1.995 , 1.973 , 1.950 , 1.926 , 1.900 , 1.874 , 1.847 , 1.819 , 1.791 , 1.762 , 1.733 , 1.703 , 1.673 , 1.643 , 1.614 , 1.584 , 1.555 , 1.526 , 1.498 , 1.470 , 1.443 , 1.417 , 1.391 , 1.366 , 1.342 , 1.319 , 1.296 , 1.275 , 1.253 , 1.233 , 1.213 , 1.194 , 1.176 , 1.158 , 1.140 , 1.124 , 1.107 , 1.091 , 1.076 , 1.061 , 1.046 , 1.032 , 1.017 , 1.004 , 0.990 , 0.977 , 0.963 , 0.950 , 0.938 , 0.925 , 0.912 , 0.899 , 0.887 , 0.874 , 0.862 , 0.849 , 0.836 , 0.823 , 0.810 , 0.797 , 0.784 , 0.771 , 0.757 , 0.744 , 0.730 , 0.715 , 0.701 , 0.686 , 0.671 , 0.655 , 0.639 , 0.623 , 0.606 , 0.589 , 0.571 , 0.553 , 0.534 , 0.514 , 0.494 , 0.474 , 0.453 , 0.431 , 0.409 , 0.386 , 0.363 , 0.339 , 0.315 , 0.291 , 0.266 , 0.241 , 0.216 , 0.190 , 0.165 , 0.139 , 0.114 , 0.088 , 0.063 , 0.038 , 0.013 , -0.012 , -0.037 , -0.062 , -0.086 , -0.110 , -0.134 , -0.158 , -0.181 , -0.205 , -0.228 , -0.251 , -0.274 , -0.297 , -0.320 , -0.343 , -0.366 , -0.388 , -0.411 , -0.434 , -0.457 , -0.481 , -0.504 , -0.527 , -0.551 , -0.574 , -0.598 , -0.622 , -0.646 , -0.670 , -0.694 , -0.719 , -0.743 , -0.768 , -0.793 , -0.817 , -0.842 , -0.867 , -0.892 , -0.917 , -0.942 , -0.967 , -0.993 , -1.018 , -1.043 , -1.068 , -1.094 , -1.119 , -1.144 , -1.170 , -1.195 , -1.220 , -1.245 , -1.270 , -1.295 , -1.319 , -1.343 , -1.368 , -1.391 , -1.414 , -1.437 , -1.460 , -1.481 , -1.503 , -1.523 , -1.543 , -1.562 , -1.580 , -1.597 , -1.613 , -1.628 , -1.643 , -1.656 , -1.669 , -1.680 , -1.691 , -1.700 , -1.709 , -1.717 , -1.725 , -1.731 , -1.738 , -1.744 , -1.749 , -1.754 , -1.760 , -1.765 , -1.770 , -1.776 , -1.781 , -1.787 , -1.793 , -1.800 , -1.807 , -1.815 , -1.823 , -1.831 , -1.840 , -1.850 , -1.859 , -1.869 , -1.879 , -1.889 , -1.900 , -1.910 , -1.920 , -1.930 , -1.939 , -1.949 , -1.958 , -1.966 , -1.974 , -1.981 , -1.988 , -1.995 , -2.001 , -2.006 , -2.011 , -2.016 , -2.021 , -2.026 , -2.030 , -2.035 , -2.040 , -2.045 , -2.050 , -2.056 , -2.063 , -2.070 , -2.077 , -2.086 , -2.095 , -2.104 , -2.115 , -2.126 , -2.138 , -2.150 , -2.163 , -2.177 , -2.191 , -2.205 , -2.219 , -2.234 , -2.248 , -2.262 , -2.276 , -2.290 , -2.303 , -2.315 , -2.327 , -2.338 , -2.348 , -2.357 , -2.365 , -2.371 , -2.377 , -2.382 , -2.386 , -2.389 , -2.390 , -2.391 , -2.391 , -2.390 , -2.389 , -2.386 , -2.383 , -2.380 , -2.376 , -2.372 , -2.367 , -2.362 , -2.357 , -2.352 , -2.347 , -2.342 , -2.337 , -2.331 , -2.326 , -2.321 , -2.316 , -2.311 , -2.306 , -2.302 , -2.297 , -2.292 , -2.287 , -2.282 , -2.277 , -2.272 , -2.266 , -2.260 , -2.254 , -2.247 , -2.240 , -2.233 , -2.224 , -2.216 , -2.206 , -2.196 , -2.185 , -2.174 , -2.162 , -2.149 , -2.135 , -2.121 , -2.106 , -2.091 , -2.075 , -2.058 , -2.041 , -2.023 , -2.005 , -1.987 , -1.969 , -1.950 , -1.931 , -1.912 , -1.894 , -1.875 , -1.856 , -1.838 , -1.820 , -1.802 , -1.785 , -1.768 , -1.751 , -1.735 , -1.720 , -1.705 , -1.690 , -1.677 , -1.663 , -1.651 , -1.639 , -1.628 , -1.617 , -1.607 , -1.598 , -1.589 , -1.581 , -1.573 , -1.567 , -1.560 , -1.555 , -1.550 , -1.545 , -1.542 , -1.538 , -1.535 , -1.533 , -1.531 , -1.529 , -1.528 , -1.527 , -1.526 , -1.525 , -1.524 , -1.523 , -1.522 , -1.521 , -1.520 , -1.518 , -1.516 , -1.514 , -1.511 , -1.508 , -1.505 , -1.500 , -1.495 , -1.489 , -1.483 , -1.476 , -1.468 , -1.459 , -1.449 , -1.438 , -1.427 , -1.414 , -1.401 , -1.386 , -1.370 , -1.354 , -1.336 , -1.317 , -1.297 , -1.276 , -1.254 , -1.231 , -1.207 , -1.182 , -1.157 , -1.130 , -1.103 , -1.076 , -1.048 , -1.019 , -0.991 , -0.962 , -0.933 , -0.905 , -0.876 , -0.848 , -0.821 , -0.793 , -0.767 , -0.740 , -0.715 , -0.690 , -0.665 , -0.642 , -0.619 , -0.597 , -0.575 , -0.554 , -0.533 , -0.514 , -0.494 , -0.475 , -0.457 , -0.439 , -0.421 , -0.404 , -0.387 , -0.371 , -0.354 , -0.338 , -0.322 , -0.306 , -0.290 , -0.275 , -0.259 , -0.243 , -0.227 , -0.212 , -0.196 , -0.180 , -0.164 , -0.147 , -0.131 , -0.114 , -0.097 , -0.080 , -0.063 , -0.045 , -0.027 , -0.009 , 0.009 , 0.028 , 0.047 , 0.066 , 0.085 , 0.104 , 0.124 , 0.144 , 0.163 , 0.183 , 0.203 , 0.223 , 0.243 , 0.263 , 0.283 , 0.303 , 0.323 , 0.343 , 0.363 , 0.383 , 0.403 , 0.422 , 0.442 , 0.462 , 0.481 , 0.500 , 0.520 , 0.539 , 0.558 , 0.576 , 0.595 , 0.613 , 0.632 , 0.650 , 0.667 , 0.685 , 0.702 , 0.719 , 0.736 , 0.752 , 0.769 , 0.784 , 0.800 , 0.816 , 0.831 , 0.846 , 0.860 , 0.875 , 0.889 , 0.903 , 0.917 , 0.931 , 0.944 , 0.958 , 0.971 , 0.984 , 0.998 , 1.011 , 1.024 , 1.037 , 1.050 , 1.063 , 1.076 , 1.089 , 1.102 , 1.115 , 1.128 , 1.141 , 1.154 , 1.167 , 1.181 , 1.194 , 1.207 , 1.220 , 1.233 , 1.247 , 1.260 , 1.274 , 1.288 , 1.302 , 1.317 , 1.332 , 1.347 , 1.363 , 1.379 , 1.396 , 1.414 , 1.432 , 1.451 , 1.471 , 1.492 , 1.514 , 1.537 , 1.562 , 1.587 , 1.614 , 1.642 , 1.671 , 1.702 , 1.734 , 1.768 , 1.802 , 1.838 , 1.875 , 1.912 , 1.950 , 1.989 , 2.028 , 2.067 , 2.106 , 2.144 , 2.181 , 2.217 , 2.252 , 2.285 , 2.316 , 2.344 , 2.370 , 2.393 , 2.413 , 2.430 , 2.445 , 2.455 , 2.463 , 2.468 , 2.470 , 2.469 , 2.466 , 2.461 , 2.453 , 2.444 , 2.434 , 2.422 , 2.410 , 2.397 , 2.385 , 2.372 , 2.360 , 2.349 , 2.339 , 2.330 , 2.323 , 2.317 , 2.313 , 2.311 , 2.311 , 2.313 , 2.317 , 2.323 , 2.331 , 2.341 , 2.353 , 2.367 , 2.383 , 2.401 , 2.420 , 2.440 , 2.462 , 2.484 , 2.507 , 2.531 , 2.554 , 2.577 , 2.599 , 2.620 , 2.639 , 2.657 , 2.673 , 2.686 , 2.697 , 2.705 , 2.710 , 2.712 ];
y = [ 0.000 , 0.025 , 0.049 , 0.074 , 0.098 , 0.123 , 0.147 , 0.172 , 0.196 , 0.221 , 0.245 , 0.269 , 0.293 , 0.317 , 0.341 , 0.365 , 0.389 , 0.413 , 0.436 , 0.460 , 0.483 , 0.506 , 0.529 , 0.552 , 0.575 , 0.598 , 0.621 , 0.644 , 0.666 , 0.689 , 0.711 , 0.734 , 0.756 , 0.778 , 0.800 , 0.822 , 0.844 , 0.866 , 0.888 , 0.910 , 0.931 , 0.953 , 0.974 , 0.995 , 1.016 , 1.037 , 1.058 , 1.079 , 1.099 , 1.120 , 1.141 , 1.161 , 1.182 , 1.202 , 1.223 , 1.243 , 1.264 , 1.284 , 1.305 , 1.325 , 1.346 , 1.366 , 1.386 , 1.406 , 1.426 , 1.445 , 1.464 , 1.483 , 1.501 , 1.518 , 1.535 , 1.551 , 1.566 , 1.580 , 1.593 , 1.605 , 1.616 , 1.626 , 1.634 , 1.642 , 1.648 , 1.653 , 1.657 , 1.661 , 1.663 , 1.665 , 1.666 , 1.666 , 1.666 , 1.666 , 1.665 , 1.664 , 1.664 , 1.663 , 1.663 , 1.663 , 1.663 , 1.664 , 1.665 , 1.667 , 1.670 , 1.673 , 1.676 , 1.681 , 1.686 , 1.692 , 1.698 , 1.705 , 1.713 , 1.721 , 1.731 , 1.741 , 1.751 , 1.762 , 1.774 , 1.787 , 1.800 , 1.814 , 1.828 , 1.844 , 1.859 , 1.876 , 1.893 , 1.911 , 1.929 , 1.948 , 1.967 , 1.988 , 2.008 , 2.030 , 2.052 , 2.074 , 2.097 , 2.120 , 2.145 , 2.169 , 2.194 , 2.220 , 2.246 , 2.272 , 2.299 , 2.325 , 2.353 , 2.380 , 2.408 , 2.435 , 2.462 , 2.489 , 2.516 , 2.542 , 2.568 , 2.593 , 2.617 , 2.639 , 2.661 , 2.681 , 2.700 , 2.717 , 2.732 , 2.745 , 2.757 , 2.766 , 2.773 , 2.779 , 2.782 , 2.783 , 2.783 , 2.780 , 2.776 , 2.771 , 2.764 , 2.756 , 2.746 , 2.736 , 2.725 , 2.713 , 2.701 , 2.689 , 2.677 , 2.664 , 2.652 , 2.641 , 2.629 , 2.618 , 2.608 , 2.598 , 2.589 , 2.581 , 2.573 , 2.566 , 2.559 , 2.554 , 2.549 , 2.544 , 2.540 , 2.537 , 2.534 , 2.531 , 2.529 , 2.527 , 2.526 , 2.524 , 2.523 , 2.521 , 2.520 , 2.519 , 2.517 , 2.516 , 2.514 , 2.512 , 2.510 , 2.508 , 2.506 , 2.503 , 2.501 , 2.498 , 2.494 , 2.491 , 2.487 , 2.483 , 2.479 , 2.474 , 2.469 , 2.463 , 2.457 , 2.451 , 2.444 , 2.436 , 2.428 , 2.419 , 2.410 , 2.399 , 2.388 , 2.376 , 2.363 , 2.349 , 2.334 , 2.317 , 2.300 , 2.282 , 2.262 , 2.242 , 2.220 , 2.197 , 2.174 , 2.149 , 2.124 , 2.097 , 2.071 , 2.043 , 2.015 , 1.987 , 1.958 , 1.930 , 1.901 , 1.873 , 1.845 , 1.817 , 1.789 , 1.762 , 1.736 , 1.710 , 1.684 , 1.660 , 1.636 , 1.612 , 1.590 , 1.568 , 1.546 , 1.525 , 1.505 , 1.485 , 1.465 , 1.445 , 1.426 , 1.407 , 1.388 , 1.368 , 1.349 , 1.330 , 1.310 , 1.290 , 1.270 , 1.250 , 1.230 , 1.209 , 1.188 , 1.167 , 1.146 , 1.125 , 1.104 , 1.082 , 1.061 , 1.040 , 1.019 , 0.999 , 0.978 , 0.958 , 0.938 , 0.918 , 0.899 , 0.880 , 0.861 , 0.843 , 0.824 , 0.806 , 0.788 , 0.771 , 0.753 , 0.736 , 0.718 , 0.701 , 0.683 , 0.666 , 0.648 , 0.630 , 0.612 , 0.593 , 0.575 , 0.556 , 0.536 , 0.517 , 0.497 , 0.477 , 0.456 , 0.435 , 0.414 , 0.393 , 0.372 , 0.350 , 0.328 , 0.306 , 0.284 , 0.262 , 0.240 , 0.218 , 0.196 , 0.174 , 0.152 , 0.130 , 0.108 , 0.086 , 0.065 , 0.043 , 0.021 , 0.000 , -0.021 , -0.043 , -0.064 , -0.085 , -0.106 , -0.127 , -0.148 , -0.168 , -0.189 , -0.210 , -0.230 , -0.251 , -0.271 , -0.292 , -0.312 , -0.333 , -0.353 , -0.373 , -0.393 , -0.413 , -0.432 , -0.452 , -0.471 , -0.490 , -0.509 , -0.527 , -0.546 , -0.563 , -0.581 , -0.598 , -0.615 , -0.632 , -0.648 , -0.664 , -0.679 , -0.694 , -0.709 , -0.723 , -0.737 , -0.751 , -0.764 , -0.777 , -0.790 , -0.802 , -0.814 , -0.827 , -0.839 , -0.850 , -0.862 , -0.874 , -0.886 , -0.897 , -0.909 , -0.921 , -0.933 , -0.945 , -0.958 , -0.971 , -0.983 , -0.997 , -1.010 , -1.024 , -1.038 , -1.053 , -1.068 , -1.084 , -1.100 , -1.117 , -1.134 , -1.151 , -1.170 , -1.189 , -1.208 , -1.228 , -1.249 , -1.270 , -1.292 , -1.315 , -1.338 , -1.362 , -1.386 , -1.411 , -1.436 , -1.462 , -1.488 , -1.514 , -1.541 , -1.568 , -1.594 , -1.621 , -1.648 , -1.675 , -1.702 , -1.728 , -1.755 , -1.780 , -1.806 , -1.831 , -1.855 , -1.879 , -1.902 , -1.924 , -1.945 , -1.965 , -1.984 , -2.002 , -2.018 , -2.033 , -2.047 , -2.059 , -2.069 , -2.077 , -2.083 , -2.088 , -2.091 , -2.091 , -2.090 , -2.087 , -2.082 , -2.076 , -2.068 , -2.058 , -2.047 , -2.035 , -2.022 , -2.008 , -1.993 , -1.978 , -1.962 , -1.947 , -1.931 , -1.916 , -1.901 , -1.886 , -1.872 , -1.859 , -1.847 , -1.836 , -1.826 , -1.816 , -1.808 , -1.801 , -1.795 , -1.790 , -1.787 , -1.784 , -1.782 , -1.782 , -1.782 , -1.784 , -1.786 , -1.790 , -1.794 , -1.800 , -1.806 , -1.813 , -1.821 , -1.830 , -1.840 , -1.851 , -1.862 , -1.874 , -1.886 , -1.899 , -1.913 , -1.926 , -1.940 , -1.955 , -1.969 , -1.983 , -1.997 , -2.010 , -2.023 , -2.036 , -2.048 , -2.060 , -2.071 , -2.081 , -2.090 , -2.098 , -2.106 , -2.112 , -2.118 , -2.123 , -2.127 , -2.130 , -2.132 , -2.134 , -2.135 , -2.135 , -2.135 , -2.134 , -2.132 , -2.130 , -2.127 , -2.124 , -2.120 , -2.116 , -2.111 , -2.106 , -2.100 , -2.094 , -2.087 , -2.079 , -2.071 , -2.063 , -2.054 , -2.044 , -2.034 , -2.023 , -2.012 , -2.001 , -1.989 , -1.976 , -1.963 , -1.950 , -1.936 , -1.923 , -1.909 , -1.894 , -1.880 , -1.866 , -1.851 , -1.837 , -1.822 , -1.808 , -1.793 , -1.779 , -1.765 , -1.751 , -1.737 , -1.723 , -1.709 , -1.696 , -1.682 , -1.669 , -1.656 , -1.643 , -1.630 , -1.617 , -1.604 , -1.592 , -1.579 , -1.567 , -1.554 , -1.542 , -1.530 , -1.518 , -1.507 , -1.495 , -1.484 , -1.473 , -1.463 , -1.452 , -1.442 , -1.433 , -1.424 , -1.415 , -1.407 , -1.400 , -1.393 , -1.387 , -1.381 , -1.376 , -1.372 , -1.368 , -1.365 , -1.363 , -1.361 , -1.360 , -1.359 , -1.359 , -1.360 , -1.360 , -1.361 , -1.362 , -1.363 , -1.363 , -1.364 , -1.363 , -1.363 , -1.361 , -1.358 , -1.354 , -1.348 , -1.342 , -1.333 , -1.323 , -1.311 , -1.297 , -1.282 , -1.264 , -1.245 , -1.225 , -1.202 , -1.178 , -1.153 , -1.127 , -1.099 , -1.071 , -1.042 , -1.013 , -0.983 , -0.953 , -0.923 , -0.894 , -0.864 , -0.835 , -0.807 , -0.779 , -0.752 , -0.725 , -0.699 , -0.674 , -0.649 , -0.625 , -0.602 , -0.580 , -0.558 , -0.537 , -0.516 , -0.495 , -0.475 , -0.456 , -0.436 , -0.416 , -0.397 , -0.378 , -0.358 , -0.338 , -0.318 , -0.298 , -0.278 , -0.257 , -0.235 , -0.213 , -0.191 , -0.168 , -0.145 , -0.122 , -0.098 , -0.074 , -0.049 , -0.025 , -0.000 ];

figure, hold on, grid on, axis equal,

i = round(numel(x) * 0.15);

plot(x,y)
plot([0,x(i)], [0,y(i)],'r')
plot([x(i)], [y(i)],'r.')

l = 4;
quiver(0,0,l,0,'k')
quiver(0,0,0,l,'k')