# Estimate Lyapunov Exponent

Interactively estimate the Lyapunov exponent of a uniformly sampled signal in the Live Editor

## Description

Use the Lyapunov exponent to characterize the rate of separation of infinitesimally close trajectories in phase space to distinguish different attractors. The Lyapunov exponent is useful in quantifying the level of chaos in a system, which in turn can be used to detect potential faults. A negative Lyapunov exponent indicates convergence, while a positive Lyapunov exponents indicates divergence and chaos.

To add the Estimate Lyapunov Exponent task to a live script in the MATLAB Editor:

• On the Live Editor tab, select Task > Estimate Lyapunov Exponent.

• In a code block in your script, type a relevant keyword, such as `Lyapunov` or `Lyapunov exponent`. Select `Estimate Lyapunov Exponent` from the suggested command completions.

## Examples

expand all

Use the Estimate Lyapunov Exponent task in the Live Editor to interactively estimate the Lyapunov exponent of a uniformly sampled signal. Experiment with different values for lag, embedding dimension, expansion range and mean period to align the linear fit line with the original data plot. The task automatically generates code reflecting your selections. Open this example to see a preconfigured script containing the Estimate Lyapunov Exponent task.

For this example, consider '`lyapExpData.mat`' which contains reconstructed phase space signal `phaseSpace` sampled at 100 Hz.

`load('lyapExpData.mat','phaseSpace')`

To estimate the Lyapunov exponent of the signal `phaseSpace`, open the Estimate Lyapunov Exponent in the Live Editor. On the Live Editor tab, select Task > Estimate Lyapunov Exponent. In the task, select signal `phaseSpace`. Since the selected signal is a phase space signal, select `Phase` `space` from the Signal Type dropdown menu. The signal was sampled at 100 Hz, hence specify this value in the Sampling Rate field.1 The Estimate Lyapunov Exponent task automatically computes the embedding dimension and lag from the phase space data and creates the Lyapunov exponent plot with default values for expansion range and mean period. If your linear fit line does not align with the original data line using the default expansion range values, try different values in the Expansion Range Min, Expansion Range Max and Mean Period fields until the alignment is satisfactory. For this example, use the minimum value of 3 and maximum value of 7 for the best alignment. The default mean period value of 166 provides good alignment for the signal `phaseSpace`. You can toggle displaying the output of the Lyapunov exponent value in the Live Editor output using the Output Display option. The task generates code in your live script. The generated code reflects the parameters and options you specify. To see the generated code, click at the bottom of the task parameter area. The task expands to display the generated code. By default, the generated code uses `lyapExp` as the name of the output variable. To specify a different output variable name, enter a new name in the summary line at the top of the task. For instance, change the name to `lExponent`. The task updates the generated code to reflect the new variable name, and the new variable `lExponent` appears in the MATLAB workspace. A negative Lyapunov exponent indicates convergence, while positive Lyapunov exponents demonstrate divergence and chaos. The magnitude of `lExponent` is an indicator of the rate of convergence or divergence of the infinitesimally close trajectories.

## Parameters

Select Signal

Select a uniformly sampled time-domain signal in array or timetable format. If the signal has multiple columns, the Estimate Lyapunov Exponent task computes the Lyapunov exponent by treating it as a multivariate signal. If the signal is a row vector, then the Estimate Lyapunov Exponent task treats it as a univariate signal.

Specify the type of the selected signal as either '`Time Domain`' or '`Phase space`'. If you specify the signal type as:

• '`Time Domain`', then also specify the embedding dimension and time lag for your signal.

• '`Phase space`', then the Estimate Correlation Dimension task automatically computes the embedding dimension and time lag using the phase space information.

Specify the sampling frequency of the data set as a scalar. The Estimate Lyapunov Exponent task uses a value of `2π` or `6.283 Hz` by default. When the signal data is in a timetable, the Estimate Lyapunov Exponent task infers the sampling rate from the data set.

Specify Lyapunov Exponent Parameters

Specify the number of dimensions of phase space vectors as a scalar or vector from the MATLAB workspace. When you specify the embedding dimension as a scalar, then the Estimate Lyapunov Exponent task uses the same embedding dimension value to estimate the value of Lyapunov exponent for all the columns of the uniformly sampled signal.

The `Embedding Dimension` drop down is active only when you specify the signal type as '`Time Domain`'. For phase space signals, the Estimate Lyapunov Exponent task automatically computes the embedding dimension from the phase space data.

If you do not know the value of embedding dimension for your signal, then you can compute it using the Reconstruct Phase Space task.

Specify time lag between successive phase vectors as a scalar or vector from the MATLAB workspace. When you specify the time lag as a scalar, then the Estimate Lyapunov Exponent task uses the same time delay value to estimate the value of Lyapunov exponent for all the columns of the uniformly sampled signal. If you specify the embedding dimension as a vector, then specify the time lag also as a vector of the same length.

The `Time Lag` drop down is active only when you specify the signal type as '`Time Domain`'. For phase space signals, the Estimate Lyapunov Exponent task automatically computes the time lag from the phase space data.

If you do not know the value of time lag for your signal, then you can compute it using the Reconstruct Phase Space task.

Specify the minimum expansion step value used to compute the expansion rate to estimate the Lyapunov exponent. Try different values such that the linear fit line aligns with the original data line in the plot.

Specify the maximum expansion step value used to compute the expansion rate to estimate the Lyapunov exponent. Try different values such that the linear fit line aligns with the original data line in the plot.

Specify the threshold value to compute the nearest neighbor `i*` for a point `i` to estimate the largest Lyapunov exponent. For more information, see `lyapunovExponent`.

Visualize Results

Toggle to display the value of Lyapunov exponent in the Live Editor output.
{"ft_lang_label":"__label__en","ft_lang_prob":0.62780744,"math_prob":0.9365938,"size":4978,"snap":"2020-45-2020-50","text_gpt3_token_len":1076,"char_repetition_ratio":0.17691998,"word_repetition_ratio":0.3063291,"special_character_ratio":0.18380876,"punctuation_ratio":0.0702381,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9932132,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16],"im_url_duplicate_count":[null,1,null,1,null,1,null,1,null,1,null,1,null,1,null,1,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-10-30T11:10:48Z\",\"WARC-Record-ID\":\"<urn:uuid:7fd18646-5664-42f4-85ce-f7532c8e6fea>\",\"Content-Length\":\"98282\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:dc97ac20-5dd1-4994-b308-5eea29279303>\",\"WARC-Concurrent-To\":\"<urn:uuid:917bea7e-5581-4606-b08f-9451bf6402d4>\",\"WARC-IP-Address\":\"184.25.198.13\",\"WARC-Target-URI\":\"https://www.mathworks.com/help/predmaint/ref/estimatelyapunovexponent.html\",\"WARC-Payload-Digest\":\"sha1:53JSJ2BKV2JJKOWBIOLW3E44Q46LKXI5\",\"WARC-Block-Digest\":\"sha1:EDO2SJO2ZJWLCPXJTRVPP2IP5YTBFK2A\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-45/CC-MAIN-2020-45_segments_1603107910204.90_warc_CC-MAIN-20201030093118-20201030123118-00080.warc.gz\"}"}