How to change the interpolation method of timeseries inside Simulink?

조회 수: 2 (최근 30일)
Luis Ruiz
Luis Ruiz 2018년 9월 10일
편집: Luis Ruiz 2018년 9월 10일
I have a timeseries object, and I am defining the interpolation method to be cubic Hermitian:
hermitian_interp_s = @( newtime, oldtime, olddata ) ...
interp1( oldtime, olddata, newtime, 'pchip', 8 );
vector_ts = setinterpmethod( vector_ts, hermitian_interp_s );
In code, an m. file, this works fine. Now I am saving this timeseries to be used in Simulink:
data_struct = struct( 'vector_ts', vector_ts );
save 'timeseries_data' 'data_struct' -v7.3;
bus_object = Simulink.Bus.createObject( data_struct );
And then I load it inside Simulink with a From File block. This block doesn't load the interpolation method defined for the timeseries that I created, it only supports linear and zero order.
So my question is, is there a way to make Simulink hold the interpolation method defined for the timeseries object?
I know it is not working because in the interpolation method I am defining that extrapolated values will get '8' all the time. In code that can be verified with:
vector_ts_2 = resample( vector_ts, new_time_vector );
vector_ts_2 uses the interpolation method defined by setinterpmethod, but not the From File block in Simulink.

답변 (0개)

카테고리

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

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by