I am getting an error trying to add axis titles to my plot. I am using a for loop, but it is only letting me add a legend and a title.
this is the error message:
Index exceeds the number of array elements (4). Error in Homework_1 (line 12) xlabel('real')
z = [2 + 5i; 1.41+1.41i; 5.87+9.15i; -3.07+6.72i; 0.997+0.071i; 3*exp(1.23i); 2*exp((pi/2)*1i); 13*exp(1i); 3; 2+11i; 4+2i; (1/5)+(4/5)*1i; ] ;s = ['o'; '*'; 's'; 'p'; '+'; '>'; '<'; 'x'; 'd'; '.'; 'h'; '^';];for index = 1:12 plot (z(index), s(index), 'MarkerSize', 10 ); hold on; endhold off;title('complex numbers');legend('2 + 5i', '1.41+1.41i', '5.87+9.15i', '-3.07+6.72i', '0.997+0.071i', '3*exp(1.23i)', '2*exp((pi/2)*1i)', '13*exp(1i)', '3', '2+11i', '4+2i', '(1/5)+(4/5)*1i');xlabel('real');ylabel('imaginary');
Best Answer