Thread Subject:
Solving a Time-Varying Matrix Differential Equation

Subject: Solving a Time-Varying Matrix Differential Equation

From: Pianist

Date: 1 Aug, 2013 05:35:11

Message: 1 of 1

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?

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us