I am trying integration by trapz but I am geting NaN numbers in answer, How to solve this problem ?

I wrote command as follow, Total_Fuel_consumption=trapz(Vel.time,IFC)
What might be the reason of I am getting NaN Answer.

Answers (1)

I would guess that there are NaN elements in Vel.time or IFC.
Best wishes
Torsten.

2 Comments

Hi Torsten, Thank you for your answer, I think problem is in IFC, I calculated it with interpolation as below, lambda1=[0 0.1 0.3 0.5 0.6 0.7 0.8 0.88 0.950449662038956] A=[0 65 70 80 90 100 120 150 170] IFC=interp1(lambda1,A,lambda).*Engine_Torque.*Engine_speed*10^-6
I checked for NaN value in IFC but there is no any NaN value. If I try to get std(IFC) it gives NaN.
Please let me know solution to this problem if you can solve it.
Why not just outputting the IFC array ?
I guess you'll immediately see this way what the problem is.
Best wishes
Torsten.

Sign in to comment.

Asked:

on 16 Oct 2015

Commented:

on 16 Oct 2015

Community Treasure Hunt

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

Start Hunting!