3
votes

Good day. I am interested in solving a problem of the form:

x_dot = Ax + F,

using Matlab. Usage of a numerical solver ( ode23/ode45) seems straightforward, but in my case the matrix A and vector F are state dependent. Thus, i need to update them after each iteration step using the newly derived state.

Can it actually be done using ode23/ode45? Do i need to follow another path?

Thanks in advance, any insight appreciated.

1
Can you tell us what the updates to A and F are? If they are linear, you should be able to "re-arrange" this into a single, larger matrix differential equation. - Sanjay Manohar
in other words, what is A_dot and F_dot as a function of x and t? - Sanjay Manohar
It is possible. ode45 solves non-stiff differential equation in the form x'(t) = f(t,x), and your problem fits the description. Type doc ode45 in your Command Window for details. - user2271770
Sanjay Manohar, the problem is highly non linear. The equation was derived after application of finite element analysis on a structure, thus derivatives of A and F cannot be described analytically. Thanks for taking time to review/answer this. - Paraskevas Dimitris

1 Answers

0
votes

Your problem fits the description of ode45 quite well. For example, take the following meaningless equations, and numerically solve the system for t = [0,1], x(0) = (1,1):

    A = @(t,x) [       x(2),    exp(-t)  ; ...
                  exp(-2*t),       x(1)  ];

    F = @(t,x) [   -0.1*x(2)  ; ...
                 sin(2*pi*t)  ];

    [t_out, x_out] = ode45(@(t,x) A(t,x)*x + F(t,x), 0:0.01:1, [1;1]);

    figure();
    plot(t_out,x_out(:,1), '-b');
    hold on;
    plot(t_out,x_out(:,2), '-r');