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

2 次查看(过去 30 天)
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!

采纳的回答

Torsten
Torsten 2016-7-29
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Surrogate Optimization 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by