I'm trying to program function (or even better it it already exists) in scilab that calculates a regular timed samples of values. IE: I have a vector 'values' which defines contains the value of a signal at different times. This times are in the vector 'times'. So at time times(N), the signal has value values(N). At the moment the times are not regular, so the variable 'times' and 'values' can look like:
times = [0, 2, 6, 8, 14] values= [5, 9, 10, 1, 6] This represents that the signal had value 5 from second 0 to second 2. Value 9 from second 2 to second 6, etc. Therefore, if I want to calculate the signal average value I can not just calculate the average of vector 'values'. This is because for example the signal can be for a long time with the same value, but there will be only one value in the vector. One option is to take the deltaT to calculate the media, but I will also need to perform other calculations:average, etc. Other option is to create a function that given a deltaT, samples the time and values vectors to produce an equally spaced timeVector and corresponding values. For example, with deltaT=2 and the previous vectors, [sampledTime, sampledValues] = regularSample(times, values, 2) sampledTime = [0, 2, 4, 6, 8, 10, 12, 14] sampledValues = [5, 9, 9, 10, 1, 1, 1, 6] This is easy if deltaT is small enough to fit exactly with all the times. If the deltaT is bigger, then the average of values or some aproximation must be done... Is there anything already done in Scilab? How can this function be programmed? Thanks a lot! PS: I don't know if this is the correct forum to post scilab questions, so any pointer would also be useful. -- View this message in context: http://mailinglists.scilab.org/How-to-get-a-reguar-sampled-vector-in-Scilab-tp4028712.html Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com. _______________________________________________ users mailing list [email protected] http://lists.scilab.org/mailman/listinfo/users
