function stem3(n,s,color); % function stem3(n,s,color); % % stems in 3d coordinates. color might be 'r', 'g', or the like. % n and s should be line vectors. % % does not work yet with the color ... if nargin == 2, % default color is blue. color='b'; end m = length(s); x = n'; xx = zeros(3*m,1); xx(1:3:3*m,:) = x; xx(2:3:3*m,:) = x; xx(3:3:3*m,:) = NaN; y = real(s)'; yy = zeros(3*m,1); yy(2:3:3*m,:) = y; yy(3:3:3*m,:) = NaN; z = imag(s)'; zz = zeros(3*m,1); zz(2:3:3*m,:) = z; zz(3:3:3*m,:) = NaN; plot3(x,y,z,'bo'); hold on; plot3(xx,yy,zz,'b-'); hold off; grid xlabel('n'); ylabel('real(s)'); zlabel('imag(s)');