필터 지우기
필터 지우기

How to use interp1 in for loop?

조회 수: 4 (최근 30일)
Akshay Apte
Akshay Apte 2016년 3월 24일
편집: Walter Roberson 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일
편집: 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