How to use interp1 in for loop?

4 次查看(过去 30 天)
Akshay Apte
Akshay Apte 2016-3-24
I have a curve representing engine power. I have to find a particular value on this curve where my engine power curve intersects. This I have to find at each step ranging from 1 to 1875 values. I used interp1 function but it gives error that it requires atlas 2 values to compute. My x-axis is Engine Power (Torque multiplied speed) and y-axis has either speed/torque. When I enter this graph with my engine power i need the point where I can find exact value on curve so that I would know the torque and speed for the power. Hoping for a positive reply
  2 个评论
Muhammad Usman Saleem
编辑:Muhammad Usman Saleem 2016-3-24
read documentations about interpolate1 it is interpolating data in one dimension. Please share data use and code you are trying
Akshay Apte
Akshay Apte 2016-3-24
编辑:Walter Roberson 2016-3-24
for it=1:numel(t)
%Battery power
if Pel(it)>0
%control strategy
socmin=0.3;
socmax=0.7;
if (soc(it-1)<socmin)||((soc(it-1)<socmax)&&(Switch==1))
r(it)=min(1,(soc(it-1)-socmin)/(socmax-socmin));
Peng1(it)=(1-r(it)).*((Pel(it)/EffPE)+Auxpower);
Eng_rpm_act(it)=interp1(Pool_engine(it),ool_speed_int(it),Peng1(it),'linear');
Eng_tq_act(it)=interp1(Pool_engine(it),ool_tq_int(it),Peng1(it),'linear');
Peng(it)=Eng_rpm_act(it).*Eng_tq_act(it)*pi/30;
end
This is just a part of the program. I need Eng_rpm_act and Eng_tq_act at each step. If there is another method please share. Pool_engine is the curve consisting of-ool_speed_int and oil_tq_int multiplied. Thanks

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by