Clear Filters
Clear Filters

How to change the interpolation method of timeseries inside Simulink?

3 views (last 30 days)
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.

Answers (0)


Find more on Time Series 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!