Having trouble with linregr in matlab

6 次查看(过去 30 天)
So i have this code here with the lyapunov experiment and im trying to use linear regression of linearized data with linregr to find the numeric value of the lyapunov exponet with the time interval (7.0-17.0) and it says first i need to find the array indices according to those time values but i do not know how to find the array indices or how to implement linear regression correctly to find the exponet.
function yp = lorenz_attractor(t,y)
yp = [10 * (y(2)-y(1)); 28*y(1) - y(1)*y(3) - y(2); ...
y(1)*y(2) - (8/3)*y(3)];
tspan = [0 30]; y0 = [5 5 5]; y00 = [5.00001 5 5];
[t1, y1] = ode45(@lorenz_attractor,tspan,y0);
[t2, y2] = ode45(@lorenz_attractor,tspan,y00);
figure(1)
plot(t1,y1(:,3),t2,y2(:,3),'--')
title('y_3(t) for y(0)=[5 5 5] (solid) and y(0)=[5.00001 5 5] (dashed)')
y21 = interp1(t2,y2,t1);
figure(2)
v=log(abs(y21(:,3)- y1(:,3)));
plot(t1,v)
title('logarithm of separation of the two y_3(t) solutions')

回答(1 个)

Aditya Patil
Aditya Patil 2020-12-24
You can use fitlm for linear regression. You can check the documentation for examples.

类别

Help CenterFile Exchange 中查找有关 Linear Regression 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by