Matlab plotting Given the following linear system of differential equations
$u'(t) = 6u(t)+9v(t)+15w(t)$
$v'(t)=-5u(t)-10v(t)-21w(t)$
$w'(t)=2u(t)+5v(t)+11w(t)$ 
with the initial conditions $u(0)=1, v(0)=2, w(0)=3$
Solve the system with matlab.
First question asks to code a function that takes input t and outputs $x(t)=[u(t),v(t),w(t)]$, if this is needed to answer the question then comment asking for it.
(b) For plotting the three solution components on $I = [0,1]$, use a vector times that subdivides $I$ into 100 sub intervals. Build the corresponding vector values of the solution components (each time slot holding three components) by the commands arrayfun and cell2mat. Plot the three curves in a single frame. 
(c) Write a function solvesys that takes the coefficient matrix $A$ as well as the initial vector $\vec{x}(0)$ as input parameters and creates the plot of the three solution components on [0,1] as before. Check that it leads to the same result for the above system and then use it on the $30 \times 30$ Hilbert matrix $A$ with initial vector $\vec{x}(0)=(1,\ldots,30)$.
I have a slight understanding that for plotting $x,y,z$ graphs i need to create a 'meshgrid' although i do not know what values i am to use, or how to apply that to my question. I further don't understand the subdividing $I$ to build corresponding vector values.
 A: Given the text, it is not clear if an ODE solver is required to be written or an inbuilt one can be used. I will use inbuilt MATLAB functions, as they are generally better.
A cell array also doesn't seem like the most appropriate method to hold the solution, as a standard array is sufficient.
(b)
n = 100; % desired number of subintervals
I = linspace(0,1,n+1); % split the interval into n subintervals

x0 = [1;2;3]; % setup ininitial condition
xsol = ode45(@myfun,I,x0); % solve the problem, myfun evaluates x'

% extract the solution components
u = xsol(:,1);
v = xsol(:,2);
w = xsol(:,3);

% plot the solution
plot(I,xsol,'brk')
legend('u','v','w') % display legend

(c) This is mostly the same as the above comment, with slight modifications to allow for an arbitrary number of linear systems to be plotted.
function solvesys(A,x0)

% error checking
m = size(A,1);
if m ~= size(A,2)
    error('A matrix must be square')
elseif m ~= numel(x0)
    error('A must have the same number of rows as x0')
end

n = 100; % desired number of subintervals
I = linspace(0,1,n+1); % split the interval into n subintervals

myfun = @(x) A*x; % setup anonymous function to evaluate x'
xsol = ode45(myfun,I,x0); % solve the problem

% plot the solution
plot(I,xsol)

end % end of function solvesys

To directly answer your questions:


*

*The three functions $u$, $v$ and $w$ are functions of $t$ only, so these are only two dimensional plots: $t$ vs $u$,$v$ or $w$.

*Subdividing $I$ can be done with the linspace command, which produces a list of equally spaced items between two specified endpoints. I don't understand why you would want to use a vector times to do this.
