function p1b % Simulation of a circuit with two capacitors, change of ss variables % Feb 2016, J. Gaspar R= 1e3; C= 1e-3; A= [-1 1; 1 -2]/(R*C); B= [1/C 0]'; C= [0 1]; % note this overwrites C D= 0; [y,t]= step(ss(A,B,C,D)); figure(201); clf plot(t,y,'.-') for i=1:100 M= mk_rank2_random_matrix; A2= M*A*inv(M); B2= M*B; C2= C*inv(M); D2= D; [y,t]= step(ss(A2,B2,C2,D2)); hold on plot(t,y,'o') hold off title(sprintf('experiment %d',i)) drawnow end legend('default ss vars', 'modified ss vars') function M= mk_rank2_random_matrix while 1 M= rand(2,2); if rank(M)==2 return; end end