Need Way to calculate Line-of-Sight through Terrain that is faster than los2
Show older comments
Hello,
My code calculates among other things the Line-of-sight from multiple points in an aircraft orbit to a target on the ground. To do this I enter arrays of coordinates into los2. Everything works accurately but the runtime is just unacceptable. To do one orbit against one target takes about 20 seconds. This code will be used with others to test the suitability of several orbits against several targets. Those 20 seconds add up quickly and I'm looking at a code that takes an hour to run a simple case.
Has anyone experienced this slow of a runtime with los2? Is there an alternative method (and/or function) that would be faster than los2?
Any suggestions are welcome!
Accepted Answer
More Answers (2)
amberly hadden
on 8 Jul 2015
0 votes
Hi-- The one way to speed up such simulation is to define your output matrices or vector before loop. You can use for instance you want displacement from such observation du = zeros(m,n); dh= zeroes(m,n);....so on
tic for i = .... ...... ..... end toc
sorry if I misunderstood your question
1 Comment
Sean de Wolski
on 8 Jul 2015
0 votes
You could consider using the Parallel Computing Toolbox to calculate multiple lines-of-sight at the same time with parfor or parfeval
4 Comments
MCM
on 8 Jul 2015
Sean de Wolski
on 9 Jul 2015
You're not using parfeval correctly. What is Topo? That should be the number of outputs. Also, for parallel computing, you could not include the opening and closing of the pool in the computation cost since this is a one time thing that can remain open (no reason to close the pool unless you need to free up resources).
Also, depending on how many times you have to do this, scaling the parallel work up to a cluster or cloud with MDCS or MATLAB Compiler might be an option. How many times do you have to run this?
MCM
on 9 Jul 2015
Categories
Find more on Descriptive Statistics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!