|
Dear all,
I have the following inputs:
A a time invariant matrix
B a time invariant matrix
Kr a time invariant matrix
a is a time varying vector which is defined at each time instant
b is a time varying vector which is defined at each time instant
t_rev is the vector of time instants at which my matrix differential equation is to be solved
I would like to solve the following differential matrix equation at each instant t for q:
dqq=-(((A-B*Kr).')*qq+a-((Kr).')*b) subject to the initial condition q(0)=r1 .
I am trying to use the following code:
[tq,qq] = ode113(@(t,qq)qqdot_eq(t,qq,A,B,Kr,a,b),t_rev,r1,options)
where I am writing qqdot_eq as:
function dqq = qqdot_eq(t,qq,A,B,Kr,a,b)
for i=1:1:length(a)
qq(:,i) = reshape(qq,size(a(:,i)));
dqq(:,i)=-(((A-B*Kr).')*qq(:,i)+a(:,i)-((Kr).')*b(:,i));
dqq=dqq(:);
end
This code does not work due to something in the reshape function.
Hence, could anyone please help me in solving this problem?
|