I want to have six diagrams in different colors in one figure, but the program that I wrote only gives me one graph.
j=0;for xi=0.01:0.02:0.11;j=j+1; i1=0;for bT=0.01:0.01:5 i1=i1+1; r=xi;mass=1;tn=bT; % période naturelle
wn=2.0*pi/tn; % pulsation naturelle
k=mass*wn^2; %Rigidité
wd=wn*sqrt(1-r^2); %Pulsation amortie
a=exp(-r*wn*dt)*(r*sin(wd*dt)/sqrt(1-r^2)+cos(wd*dt));b=exp(-r*wn*dt)*(sin(wd*dt))/wd;c2=((1-2*r^2)/(wd*dt)-r/sqrt(1-r^2))*sin(wd*dt)-(1+2*r/(wn*dt))*cos(wd*dt);c=(1/k)*(2*r/(wn*dt)+exp(-r*wn*dt)*(c2));d2=exp(-r*wn*dt)*((2.0*r^2-1)/(wd*dt)*sin(wd*dt)+2.0*r/(wn*dt)*cos(wd*dt));d=(1/k)*(1-2.0*r/(wn*dt)+d2);ad=-exp(-r*wn*dt)*wn*sin(wd*dt)/(sqrt(1-r^2));bd=exp(-r*wn*dt)*(cos(wd*dt)-r*sin(wd*dt)/sqrt(1-r^2));c1 = exp(-r*wn*dt)*((wn/sqrt(1-r^2)+r/(dt*sqrt(1-r^2)))*sin(wd*dt)+cos(wd*dt)/dt);cd=(1/k)*(-1/dt+c1);d1=exp(-r*wn*dt)*(r*sin(wd*dt)/sqrt(1-r^2)+cos(wd*dt));dd=(1/(k*dt))*(1-d1);for m=2:n1u(m)=a*u(m-1)+b*v(m-1)+c*p(m-1)+d*p(m);v(m)=ad*u(m-1)+bd*v(m-1)+cd*p(m-1)+dd*p(m);ta(m)=(-2*r*wn*v(m)-wn*wn*u(m))/mass;endT(i1)=bT;K(i1,j)=max(abs(u));endendfor Q=1,6;plot(T,K(:,Q));end
Best Answer