interp1 returning NaN for values <1
显示 更早的评论
Hey all,
I have a function that I am using as part of another program, and it relies on interp1, however, my interp1 function is not returning a mix of NaNs and numbers. Here is my code:
function [T] = thrust(t);
thrust_time = xlsread('rocketdata.xlsx')
e = length(thrust_time)
time_reduced = thrust_time((1:e),2);
thrust_reduced = thrust_time((1:e),1);
A = interp1(time_reduced,thrust_reduced)
T = A(t)
end
where the XLS file has 2 columns of 153 rows. The first column is Thrust, and the second column is time. All values are positive, but the first ~25 and last ~25 thrust values are decimals less than 1 but greater than zero, which return NaN. All thrust values greater than 1 return actual numbers.
Can anyone please tell me what I am doing wrong? Thank you!
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Interpolation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!