Interpolating between values of unknown function in MATLAB
Discussion
Probably not specific to MATLAB really. But i'm creating a program where i have a list of torqu values at specific RPMs and i want to linearly interpolate between them for a specific RPM. As it isn't a defined function i have no idea where to start and would appreciate any help.
Thanks
A mech Eng student who hates computing.
Thanks
A mech Eng student who hates computing.
Tq=[100 150 200 300 450]; %your torque vector
NE=[1000 2000 3000 4000 5000]; %your engine speed vector
NE_New=1500;%The engine speed you want to know the torque at
Tq_New=interp1(NE,Tq,NE_New) % The torque at N_New engine speed
Hope that helps
Or if you want linear interpolation by hand:-
idx=min(find(NE_New>NE));
prop=(NE_New-NE(idx))/(NE(idx+1)-NE(idx));
Tq_New=Tq(idx)+prop*(Tq(idx+1)-Tq(idx))
NE=[1000 2000 3000 4000 5000]; %your engine speed vector
NE_New=1500;%The engine speed you want to know the torque at
Tq_New=interp1(NE,Tq,NE_New) % The torque at N_New engine speed
Hope that helps

Or if you want linear interpolation by hand:-
idx=min(find(NE_New>NE));
prop=(NE_New-NE(idx))/(NE(idx+1)-NE(idx));
Tq_New=Tq(idx)+prop*(Tq(idx+1)-Tq(idx))
Edited by johnaachen on Tuesday 13th April 23:31
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff



