# Problem with inverse kinematics in robotic arm using Matlab

I define my robotic arm with following code

% Link('d', 0.15005, 'a', 0.0203, 'alpha', -pi/2)
L(1) = Link([0  0.15   0    pi/2     0], 'standard');
L(2) = Link([0  0     0.15   0       0], 'standard');
L(3) = Link([0  0     0.15   0       0], 'standard');
L(4) = Link([0  0     0.15   0       0], 'standard');
% set limits for joints
%build the robot model
qready = [0 0 0 0]; % initial position of robot


And I solve inverse kinematic and plot robotic arm with code

 Td = transl([0.05 0 -0.20]);
q = rob.ikine(Td, qready,[1 1 1 0 0 0]);
plot(rob,q,'noname');


Its results are 0 -139.0348635 82.65184319 -1.286384217 which is four angles named theta1, theta2, theta3 and theta4 respectively. Now the point is I gave joint limit for theta2 as -45 to 45 degree but result output is -139 degree. Same case with theta3. Why it is so? Another thing is when I plot these angles robotic arm cross each other as shown in figure. I want to know what is wrong with code or I'm missing any thing.