Borrar filtros
Borrar filtros

I'm trying to obtain a value between two points of vectors plotted against each other using the interp1 method, but the vale keeps coming up with NaN? Any suggestions>

1 visualización (últimos 30 días)
Basically says it all in the question, but the line of code is as follows:
cet_3=interp1(Engine_Speed,Engine_Torque,ces_3);
both the Engine_Speed and Engine_Torque vectors are 1x15 vectors, and the ces_3 already has a single vale of around 55, however the value of cet_3 keeps coming out as NaN.

Respuestas (1)

Walter Roberson
Walter Roberson el 7 de Dic. de 2015
cet_3 = interp1(Engine_Speed, Engine_Torque, ces_3, 'linear', 'extrap');
interp1() by default will only interpolate between min(Engine_Speed) and max(Engine_Speed) and will return NaN for other values. You need to tell it that it is okay to extrapolate for ces_3 values outside that range.

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by