I have copy-pasted your code below, exactly as entered in your question. It runs and produces the plot with no error. I suggest that you double-check your code carefully. If you still get an error, then copy your code from MATLAB directly into a comment here, along with the exact text of any error message, so that we can take a look.
x1 = [ 1.1, 2.2, 3.4, 4, 4.5]
x2 = [0.9, 1.9, 3, 3.9, 4.3]