How to choose ODE timespan for Matlab when solving for a set of linear differential equations? -
the set of differential equations in form x'=ax+b a,b, , x matrices. attempted solve problem using ode45 function in matlab. having difficulty choosing timespan ode45 arguments, since problem did not specify. note: have tried time=[0,10]; ended big matrix factor multiplied it.
code written:
%myode45function.m file function dx_dt = myode45function (t,x) b=[1 2 3 4 5 6 7]'; a=[2 3 4 5 6 0 7; 3 6 2 1 3 5 4; 4 2 2 4 2 7 5; 5 1 4 3 5 2 1; 6 3 2 5 4 1 2; 0 5 7 2 1 8 0; 7 4 5 1 2 0 9]; dx_dt= [(a*x)+b]; end %main code clear all; clc time=[0,4]; initial=[1,1,1,1,1,1,1]; [t,x]=ode45(@myode45function, time, initial);
Comments
Post a Comment