%% DATA
k1 = (1.5+0)/2; % Should be unstable
k2 = 1.5; % Should be marginally stable
k3 = (1.5+2.5)/2; % Should be stable
k4 = 2.5; % Should be stablek5 = (57.5+2.5)/2; % Should be stablek6 = 57.5; % Should be stablek7 = 1000; % Should be stable
x = [k1,k2,k3,k4,k5,k6,k7];% Vector of ks
t = 0:.01:5;steps = ones(1,length(t)); % Input - step
t_f = tf([1 18] , [1 6 -27]);color = ['g','b','r','y','m','k','c']; % color of plots
m=1;hold onfor i = 1:length(x) t_f = tf(x(i)*[1 18] , [1 6+x(i) -27+18*x(i)]); result(i) = t_f; y = lsim(result(i),steps,t); % figure(i) When I use this method it actually plots the transfer functions
plot(t,y,color(:,m),'linewidth',1.5) % Plot w/ different colors
m = m + 1; % var to change color
endlegend({'k1','k2','k3','k4','k5','k6','k7'},'Location','NorthWest') hold off
I don't understand why it doesn't plot the rest of my x matrix. It plots the first value, x(1), then it just gives me lines = 0 of different colors. When I use figure(i), it works, but that's not what I need right now. Any suggestions? thanks
Best Answer