File Exchange

image thumbnail

Mackey Glass Time Series Prediction Using Least Mean Square

version 2.0.1 (105 KB) by Shujaat Khan
Mackey Glass Time Series Prediction Using Least Mean Square (LMS)


Updated 16 Apr 2020

View Version History

View License

In this submission, I demonstrated the problem of time series prediction using least mean square (LMS) algorithm.

Cite As

Shujaat Khan (2021). Mackey Glass Time Series Prediction Using Least Mean Square (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (9)


Shujaat Khan

Hello Mark,
Now, I uploaded a new code for you. The code is quite similar to this code but it utilize the output generated by the filter itself (you can say a feedback) to predict next outcome. In this way you can generate data for N future values.


Ah! Now I understand. Brilliant work.

If I can give a suggestion for the next update, incorporating the "few modifications" so the code can extrapolation beyond the end of data (i.e. past 3000) would be helpful.

Thanks again

Shujaat Khan

There was some mistakes in previous version. In this update I made following changes.

- correction of weight update rule.
- correction of error calculation

Shujaat Khan

In time series prediction we feed some initial values or past data to predict the future outcome. This is closely related to extrapolation. In this implementation you can only predict the first next outcome, that is to say, if you provide values for t={-M,-M+1,-M+2, ... , 0}, then you can predict the value at time t=1.

With few modifications you can change this code to predict other future values as well.


To be clear, can I modify the code to extrapolate the data to an x-value of say 3300?


I'm not sure if I understand the purpose of this algorithm

Does this algorithm extrapolate over the range of Ts (the testing data)?

If yes, why are Xs fed into the "prediction of the next outcome of the series using previous samples?

If not, what is the testing data in the context of this algorithm

Sorry, I'm new to LMS.

Thank you very much

Shujaat Khan

Thank you Mark for your positive comments.

Selection of etaf, and f is not in the part of this submission. I will try to put the explanation in the relevant submission.


A procedure for picking eta, etaf, f and M would be helpful.

Excellent work though

MATLAB Release Compatibility
Created with R2011a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!