Prev: inputParser & validateattributes
Next: draw a triangle
From: Gary on 1 Dec 2009 23:39 I am trying to work a state space solution and am getting errors in Matlab. This is being done by using ode45 to plot the solutions for the state variables (x1,x2). Given: A = [ 0 1 ; 2 4] B = [ 0 2] C = [1 0] % x1 and x2 refers to x1 = 1 and x2 = 0 D = [0] Code: x0= [1 0] A=[-10 1; -0.02 -2] for t=0:0.01:10 % x=exp(t*A)*x); end [t,y]=ode45 (@vdp1,[0 20], [20]) plot (x,t) hold on plot(t,y(:,1)) @vdp1 edit @vdp1 If you are unable to understand state space, can you please give a working example of using ode45 to plot matrices etc. Thanks.
|
Pages: 1 Prev: inputParser & validateattributes Next: draw a triangle |