Info
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
How to get 1807 point data array to 1806 data array?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I thought the process would go with interpolation like the following but not
u = interp1(u, size(u) - 1);
which gives me `NaN [integer]`, so wrong.
I do not want to lose the accuracy of the results but I need to compare the vector with its original vector which has one point less.
MATLAB: 2016b
0 Commenti
Risposte (2)
Guillaume
il 24 Ott 2016
As Marc says, you need a vector for the query points but his solution for generated that vector does not make much sense.
A good way of generating one less query point than the original is to use linspace:
uq = interp1(u, linspace(1, numel(u), numel(u)-1))
That's assuming that the original u correspond to x = 1:numel(u).
3 Commenti
Guillaume
il 25 Ott 2016
Yes, exactly what Marc said. There's nothing complicated about the code and certainly no non-linear regression. Just plain linear interpolation.
Marc Jakobi
il 24 Ott 2016
Modificato: Marc Jakobi
il 24 Ott 2016
The second input must be a vector, not the size of the output. So if you want to interpolate between the points, use something like
uq = interp1(u, (1.5:length(u) - 0.5)); %assuming u is a vector
2 Commenti
Marc Jakobi
il 24 Ott 2016
woops, wasn't paying proper attention there.
it should be
1.5:length(u)-0.5
(assuming u is a vector) Thanks for pointing it out.
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!