Help with Riccati equation

조회 수: 2 (최근 30일)
Mikle Frolov
Mikle Frolov 2023년 5월 29일
댓글: Mikle Frolov 2023년 6월 1일
% Define the Riccati equation and initial conditions
A = [0 1; -1 0]; Q = [1 0; 0 1]; R = 1; P0 = [1 0; 0 1];
% Determine the integral manifold
[V,D] = eig(Q);
M = V * sqrt(inv(D));
% Define the ODE function for numerical integration
f = @(t,P) -A' * P - P * A + P * B * inv(R) * B' * P + Q;
% Solve the ODE on the manifold
[t,P] = ode45(@(t,P) M \ f(t,M * P * M') * M', [0 10], M * P0 * M');
% Plot the solution trajectory on the manifold
plot(P(:,1,1), P(:,2,2));
xlabel('P_{11}');
ylabel('P_{22}');
title('Solution Trajectory on Manifold');
matlab complains about ode45 but I can’t figure out the reason for 2 days already((

답변 (1개)

Alan Stevens
Alan Stevens 2023년 5월 29일
You haven't defined B (in the function definition)
  댓글 수: 1
Mikle Frolov
Mikle Frolov 2023년 6월 1일
Thank you for the answer it halped a lot

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by