Having trouble with linregr in matlab

조회 수: 7 (최근 30일)
Quinton Berry
Quinton Berry 2020년 12월 16일
답변: Aditya Patil 2020년 12월 24일
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에서 Matrix Computations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by