필터 지우기
필터 지우기

The interpolation interp1 command is taking wrong values.

조회 수: 2 (최근 30일)
kajal shah
kajal shah 2017년 2월 3일
답변: cr 2017년 2월 6일
The command line is
Te_loop_max(i)=interp1(Ne,Temax,pbatt_const_Ne(i),'cubic')
inside a loop; The Temax,Pbatt are taking wrong values, . So the interpolation is coming 0 always. I am working on embedded function, simulink. Display and print command showing different values of Temax
disp(fprintf('Temax=%10.3f',Temax));
Te_loop_max(i)=interp1(Ne,Temax,pbatt_const_Ne(i),'cubic');
disp(fprintf('Ne=%10.1f, Temax=%10.3f, pbatt=%10.3f',Ne,Temax,pbatt_const_Ne(i)));
output: Temax= 12.515Temax= 12.628Temax= 13.337Temax= 13.449Temax= 13.188Temax= 13.188Temax= 12.814Temax= 12.142Temax= 10.759Temax= 9.564
Ne= 2000.0, Temax= 2500.000, pbatt= 3000.000Ne= 3250.0, Temax= 3500.000, pbatt= 4000.000Ne= 4500.0, Temax= 5000.000, pbatt= 5500.000Ne= 6000.0, Temax= 12.515, pbatt= 12.628Ne= 13.3, Temax= 13.449, pbatt= 13.188Ne= 13.2, Temax= 12.814, pbatt= 12.142Ne= 10.8, Temax= 9.564, pbatt= 2000.000 343
Please suggest

답변 (1개)

cr
cr 2017년 2월 6일
Generally, Ne and Temax are expected to be vectors. It is not clear why the statement is inside a loop. If you want to find interpolated values at various values of pbatt_const_Ne make it a vector too.

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by