Here is my code.
Z=[3 1 7];for i=1:length(Z);A(i)=Z(i)+2B(i)=Z(i)-7C(i)=Z(i)+4col=['g' 'b' 'r'];for j:length(col)x=[1 2 3];y(:,i)=[A(i) B(i),C(i)];subplot(3,1,i)plot(x,y(:,i),'color',col(j))end end
My last line of code is failing to change the color on the plots. All of the plots end up red. I want one of the plots to be green, one to be blue, and one to be red. How can I fix my code?
Best Answer