Hi Nicolas,
Originally Posted by: ola_nicolas Hi!
@Davide Carpi: On the two examples we can make any mathematical analysis we want. But I have mainly mentioned how the program behaves in this type of construction. Of course the arrays are of different sizes. I have solved through this algorithm a problem of complex interpolation on domains. After applying the basic algorithm (see green box references) on all specific sub-domains, the result will ultimately be given by a logical decision algorithm that is not presented in the files. So the algorithm was applied twice, representing as many subdomains of the interpolated phenomenon. It will usually be applied more than twice - usually 4 ... 5 times over a domain represented by a complex phenomenon. Here I just have summarized two application.
It's not a problem how many times you apply the algorithm, I've just explained you what is happening and how to fix it;
When you ask to assign a value to an index that doesn't exits, the matrix is extended up to that index; if the index exists, the element is simply overwritten.
The first time, elements of M are always not yet defined -> at each loop the matrix is extended
- i = 1 -> M = { V1 }
- i = 2 -> M = { V1 , V2 }
- i = 3 -> M = { V1 , V2 , V3 }
- i = 4 -> M = { V1 , V2 , V3 , V4 }
- i = 5 -> M = { V1 , V2 , V3 , V4 , V5 }
- i = 6 -> M = { V1 , V2 , V3 , V4 , V5 , V6 }
- i = 7 -> M = { V1 , V2 , V3 , V4 , V5 , V6 , V7 }
- i = 8 -> M = { V1 , V2 , V3 , V4 , V5 , V6 , V7 , V8 }
then you ask to interpolate between T.1 (8 elements) and M (8 elements) ->
OKThe second time, there are 8 elements in M -> since you are looping up to the 4th element, at each loop the elements are overwritten
- i = 1 -> M = { NEW_V1 , V2 , V3 , V4 , V5 , V6 , V7 , V8 }
- i = 2 -> M = { NEW_V1 , NEW_V2 , V3 , V4 , V5 , V6 , V7 , V8 }
- i = 3 -> M = { NEW_V1 , NEW_V2 , NEW_V3 , V4 , V5 , V6 , V7 , V8 }
- i = 4 -> M = { NEW_V1 , NEW_V2 , NEW_V3 , NEW_V4 , V5 , V6 , V7 , V8 }
then you ask to interpolate between T.2 (4 elements) and M (8 elements) ->
errorUsing Clear(M) or M:matrix(0,0) you initialize a new matrix and this fix your issue.
Edited by user 22 November 2017 12:21:11(UTC)
| Reason: Not specified