% % TD1 : two tanks system % % temmplate for students % initialization of the figure figure1 = figure; axes1 = axes('Parent',figure1); hold(axes1,'on'); box(axes1,'on'); grid(axes1,'on'); set(axes1,'FontSize',14); ylabel('$h_2$','FontSize',20,'Interpreter','latex'); xlabel('$h_1$','FontSize',20,'Interpreter','latex'); axis([0 2 0 2]); hold on; % number of trajectory to be plotted N = 5; % simulation and plot of N trajectories for i=1:N [H10,H20] = ginput(1); % get initial conditions by clicking in the figure simout = sim('simtwotanks'); % simulates the simulink file simtwotanks.slx h = simout.get('h'); % get the data (state) from the 'To Workspace' variable in Simulink h1 = h(:,1); h2 = h(:,2); plot(h1,h2,'r','LineWidth',2); % plot the trajectory plot(H10,H20,'*r','LineWidth',2,'MarkerSize',6) % plot the starting point end