interp2 with loop
6 views (last 30 days)
Show older comments
Hello,
I am attempting to use the interp2 function with a for loop. The following code is what I have:
%% For loop for bsfc interpolation
for i = 1:1486
XqWG =[EngineRpm(1:41)];
YqWG(i,:) = [BrakeTorqueT(i)];
VqWG = interp2(X,Y,V,XqWG,YqWG);
end
where EngineRpm is a 1X41 and BrakeTorqueT is 1486X41. Here I need to hold each value of EngineRpm(XqWG) constant so that, that single value is used to interpolate against all BrakeTorqueT values (YgWG).
The problem right now is the interpolation uses only the first column value from EngineRpm for every subsequent column in BrakeTorqueT (IE EngineRpm never moves from (1,1) to (1,2) when proceeding through the loop).I need each of the 41 columns to be interpolated with the 41 columns of BrakeTorqueT. In other words, what I need is for the EngineRpm (1,1) to be a constant XqWG value for all YqWG (1:1486,1) in the first column of Vq, then EngineRpm (1,2) is constant (XqWG) for all YqWG (1:1486,2) etc. as the loop proceeds to interpolate all the data. I hope my question has been clear, I apologize in advanced for any confusion my wording causes. Thank you.
2 Comments
Answers (0)
See Also
Categories
Find more on Interpolation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!