Main Content

resample

Resample Sobol indices or elementary effects to new time vector

Since R2020a

Description

results = resample(gsaObj,timeVector) resamples model evaluations to a vector of new time points. By default, the function uses the interp1q interpolation method.

example

results = resample(gsaObj,timeVector,method) specifies the interpolation method.

example

Examples

collapse all

Load the lotka model.

m = sbmlimport("lotka");

Decompose the variance of predators y2 into attributions of the initial values of the prey y1 and predators.

sobolResults = sbiosobol(m,["y1","y2"],"y2","StopTime",1);
plot(sobolResults);

Figure contains 6 axes objects. Axes object 1 with title sensitivity output y2, ylabel first order y1 contains 3 objects of type line. Axes object 2 with title sensitivity output y2, ylabel total order y1 contains 3 objects of type line. Axes object 3 with ylabel first order y2 contains 3 objects of type line. Axes object 4 with ylabel total order y2 contains 3 objects of type line. Axes object 5 with xlabel time, ylabel fraction of unexplained variance contains 3 objects of type line. Axes object 6 with xlabel time, ylabel total variance contains an object of type line.

Resample the Sobol indices to a new time vector.

newSobolResults = resample(sobolResults,linspace(0,1,50));
plot(newSobolResults);

Figure contains 6 axes objects. Axes object 1 with title sensitivity output y2, ylabel first order y1 contains 3 objects of type line. Axes object 2 with title sensitivity output y2, ylabel total order y1 contains 3 objects of type line. Axes object 3 with ylabel first order y2 contains 3 objects of type line. Axes object 4 with ylabel total order y2 contains 3 objects of type line. Axes object 5 with xlabel time, ylabel fraction of unexplained variance contains 3 objects of type line. Axes object 6 with xlabel time, ylabel total variance contains an object of type line.

Input Arguments

collapse all

Results from global sensitivity analysis, specified as a SimBiology.gsa.Sobol or SimBiology.gsa.ElementaryEffects object.

New time points, specified as a nonempty real numeric vector containing finite and increasing values.

If timeVector includes time points outside the time interval encompassed by the simulation data in sobolObj, resample performs extrapolation. The function issues a warning and throws an error if resampling fails due to extrapolation.

See the help for the MATLAB function corresponding to the interpolation method in use for information on how the function performs the extrapolation.

Data Types: double

Interpolation method, specified as a string or character vector. The valid options follows.

  • 'interp1q' — Use the interp1q function.

  • Use the interp1 function by specifying one of the following methods:

    • 'nearest'

    • 'linear'

    • 'spline'

    • 'pchip'

    • 'v5cubic'

  • 'zoh' — Specify the zero-order hold.

Data Types: char | string

Output Arguments

collapse all

Resampled simulation results computed at new time points, returned as a SimBiology.gsa.Sobol or SimBiology.gsa.ElementaryEffects object. If the input is a SimBiology.gsa.Sobol object, the returned results contain resampled simulation results and Sobol indices computed at new time points. If the input is an SimBiology.gsa.ElementaryEffects object, the results contain resampled simulation results and elementary effects computed at new time points.

Version History

Introduced in R2020a