1-D interpolation question
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Keny
el 21 de Abr. de 2014
Comentada: Walter Roberson
el 21 de Abr. de 2014
i have some point and values matrix. [100 ..., 195 ....,300 ...]; and i have another matrix that goes from 50 to 400; if i use interp1 and extrap option, my extrap values are added in the beginning and end of the result.
but i want to put 2 different values in beginning and end.
how can i do that?
0 comentarios
Respuesta aceptada
Walter Roberson
el 21 de Abr. de 2014
Turn off extrap. Let NaN be filled in. Then use find() and isnan() to find the boundaries of the extrapolation, and write the extrapolation constants in as desired.
2 comentarios
Walter Roberson
el 21 de Abr. de 2014
idx = ~isnan(YourVector);
first_boundary = find(idx, 1, 'first');
YourVector(1:first_boundary - 1) = 50;
second_boundary = find(idx, 1, 'last');
YourVector(second_boundary + 1 : end) = 100;
Más respuestas (1)
Ver también
Categorías
Más información sobre Interpolation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!