Clear Filters
Clear Filters

How to fit data to a function with last output as input?

2 views (last 30 days)
Hey, whats the easiest way to estimate the constants k1,k2,k3 in the function y:
y_n = k1 * x_n + k2 * x_(n-1) + k3 * y_(n-1)
I have an array of x and the desired y. I took a look at the optimization toolbox, but I dont know how to get it to work with last output/input as input.
Thanks for any suggestions!

Accepted Answer

Torsten
Torsten on 29 Jul 2016
A=zeros(N-1,3);
b=zeros(N-1);
A(:,1)=x(2:N);
A(:,2)=x(1:N-1);
A(:,3)=y(1:N-1);
b(1:N-1)=y(2:N);
k=A\b;
Best wishes
Torsten.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!