How do I make a vector of doubles continuous?

I have a row vector of length 50, named 'se', and when plotted it is a wave function. I need to convert this discrete time series into a continuous one so that I can obtain values such as se(1.2) for example. Is there a way to do this?

 Risposta accettata

Jon
Jon il 21 Apr 2022
Modificato: Jon il 21 Apr 2022
use interp1
so for example if you wanted "continuous" values at 1.2, 2.8, and 3.7, 33.5
xq = [1.2,2.8,3.7,33.5]; % query points where you want values
x = 1:50; % indices of orginal discrete series
seq = interp1( x,se,xq)

3 Commenti

If there is some further scaling, e.g samples are taken every 10 seconds, so you have 50*10= 500 seconds of data, and you want values at specified times in seconds then just scale your x value in the above
Ts = 10; % sample period in seconds
t = (1:numel(se))*Ts; % time scale for discrete points
tq = [1.2,2.8,3.7,33.5,208.42]; % query points where you want values
seq = interp1(t,se,tq)
Leo Tu
Leo Tu il 21 Apr 2022
Modificato: Leo Tu il 21 Apr 2022
Thank you @Jon, is there a way to use this to have values at any real number query point? So if my vector is of length 50, then I can get a value at any real value query point between 0 and 50. Unless the best way is to have my query points as something like 0:0.001:50 ?
Yes you can query any real value between 0 and 50. Note this is what I show in my original example where just to illustrate that they could be arbitrary real numbers between 0 and 50 I had query points [ 1.2,2.8,3.7,33.5] If you want your to have values for se at equally spaced query points than you can define your query points as 0:0.001:50. Either way is fine, it just depends upon what you need for your application.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Interpolation of 2-D Selections in 3-D Grids in Centro assistenza e File Exchange

Prodotti

Release

R2021a

Richiesto:

il 21 Apr 2022

Commentato:

Jon
il 22 Apr 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by