# How to Run PSO with Real Data

17 views (last 30 days)
Timothy Turk on 19 Sep 2020
Commented: Timothy Turk on 6 Oct 2020 at 22:45
I want to use PSO to optimize a 3D problem using real data (lat, long, alt). How is this accomplished? I see in the examples and tutorials it is done against existing surface plots; Rosenbrock, Ackley, Griewank, etc.. How do I run it against real numbers?
R2020b

Walter Roberson on 19 Sep 2020
You use whatever formula is appropriate. For example
lat=d.lat;
long=d.long;
alt=d.alt;
fun = @(x) sum((x(1)-lat).^2 + (x(2)-long).^2 + (x(3)-tan(alt)).^2);
pso(fun, 3)

#### 1 Comment

Timothy Turk on 20 Sep 2020
Thank you, Walter. I was able to use the first four lines to build the matrix. That was one of my goals.

John D'Errico on 19 Sep 2020
You can't. That is, the optimal is just the optimal value at each point in your sample. You cannot do better than that, at least, not unless you are willing to build a model of the process.
So, what are you willing to do in terms of a model? What do you know? What are you willing to assume? If you cannot build a model, then you cannot do any form of optimization that will have some chance of being better than the best point from your data.
If your data is at all noisy, then don't expect to do well of course. But one option might be to use an interpolating spline surface model. Again, noise will totally destroy any spline fit, making it useless for this purpose.

Timothy Turk on 22 Sep 2020
Thanks, Walter.
Ideally, there would only be one center.
I'll investigate the algorithms you mentioned.
The debris along with all other objects orbiting Earth larger that 10 cm cross section are continuosly cataloged by the space surveillance network. I do believe I can pull the velocity of each object from the Systems Tool Kit (STK), but don't have access to it right now. I will check tonight and respond. And, yes, agreed, velocities at different altitudes are different; lower altitudes have higher velocities.
Walter Roberson on 22 Sep 2020
When you use PSO, you hope to get out a vector of values. What properties do you want for the vector of values?
Timothy Turk on 6 Oct 2020 at 22:45
The vector I would desire is a the location of the highest density of debris in the debris field as it passes closest to the South Pole.
This is a sample of the data I can pull from STK. This only a snapshot of one piece of debris. There are 303 pieces of debris and I would use one minute increments for each piece over one orbit ~ 90 minutes.
Satellite-IRIDIUM_33_DEB_33773: LLA Position
Time (UTCG) Lat (deg) Lon (deg) Alt (km) Lat Rate (deg/sec) Lon Rate (deg/sec) Alt Rate (km/sec)
----------------------- --------- --------- ---------- ------------------ ------------------ -----------------
1 Mar 2019 18:00:00.000 -24.381 -47.011 766.760719 0.060052 0.000350 -0.028500
1 Mar 2019 18:01:00.000 -20.776 -46.997 765.107684 0.060107 0.000123 -0.026564
1 Mar 2019 18:02:00.000 -17.168 -46.996 763.578772 0.060156 -0.000057 -0.024369
1 Mar 2019 18:03:00.000 -13.558 -47.003 762.188564 0.060198 -0.000195 -0.021947
1 Mar 2019 18:04:00.000 -9.945 -47.018 760.949686 0.060233 -0.000296 -0.019331
1 Mar 2019 18:05:00.000 -6.330 -47.038 759.872637 0.060261 -0.000364 -0.016559
1 Mar 2019 18:06:00.000 -2.714 -47.061 758.965646 0.060282 -0.000401 -0.013669
1 Mar 2019 18:07:00.000 0.904 -47.086 758.234571 0.060296 -0.000408 -0.010701
1 Mar 2019 18:08:00.000 4.522 -47.110 757.682831 0.060302 -0.000385 -0.007697
1 Mar 2019 18:09:00.000 8.140 -47.131 757.311380 0.060300 -0.000331 -0.004697
1 Mar 2019 18:10:00.000 11.758 -47.149 757.118724 0.060291 -0.000245 -0.001742
1 Mar 2019 18:11:00.000 15.375 -47.160 757.100970 0.060275 -0.000124 0.001129
1 Mar 2019 18:12:00.000 18.990 -47.163 757.251922 0.060252 0.000036 0.003877
1 Mar 2019 18:13:00.000 22.605 -47.155 757.563209 0.060222 0.000242 0.006469
1 Mar 2019 18:14:00.000 26.217 -47.133 758.024451 0.060185 0.000500 0.008873
1 Mar 2019 18:15:00.000 29.827 -47.093 758.623449 0.060142 0.000823 0.011059
1 Mar 2019 18:16:00.000 33.434 -47.032 759.346408 0.060092 0.001223 0.013003
1 Mar 2019 18:17:00.000 37.038 -46.945 760.178185 0.060037 0.001722 0.014685
1 Mar 2019 18:18:00.000 40.638 -46.823 761.102548 0.059974 0.002346 0.016088
1 Mar 2019 18:19:00.000 44.235 -46.660 762.102452 0.059905 0.003136 0.017202
1 Mar 2019 18:20:00.000 47.827 -46.443 763.160329 0.059828 0.004146 0.018021
1 Mar 2019 18:21:00.000 51.414 -46.156 764.258371 0.059742 0.005461 0.018542
1 Mar 2019 18:22:00.000 54.995 -45.779 765.378823 0.059642 0.007208 0.018769
1 Mar 2019 18:23:00.000 58.570 -45.278 766.504260 0.059523 0.009593 0.018709
1 Mar 2019 18:24:00.000 62.138 -44.608 767.617864 0.059375 0.012955 0.018376
1 Mar 2019 18:25:00.000 65.694 -43.693 768.703681 0.059179 0.017897 0.017785
1 Mar 2019 18:26:00.000 69.237 -42.407 769.746856 0.058900 0.025565 0.016957
1 Mar 2019 18:27:00.000 72.759 -40.524 770.733859 0.058459 0.038350 0.015916
1 Mar 2019 18:28:00.000 76.246 -37.595 771.652675 0.057673 0.061881 0.014688
1 Mar 2019 18:29:00.000 79.663 -32.591 772.492973 0.056011 0.111760 0.013302