MATLAB: Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

check for mismatched delimiters.errorinvalid expression. when calling a function or indexing a variableuse parentheses. otherwise

i trung to run this, but it show to me this error :
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.
can any one help me .
the error is in line 2 .
this is the code:
fiqure()
1. plot (V_X(1,:)),((V_X(2,:)),'k')
2. hold on
3. title(('——–',int2str(n)))
4. plot ((matrixV(1,:)),((matrixV(2,:)),'–r*')
5. hold off

Best Answer

Remove the numbers before you commands.
Check that your parentheses are lining up the way you intend. Your first plot command has a mismatched number of opening and closing parentheses. Syntax should be plot(x,y)
plot(V_X(1,:)),((V_X(2,:)),'k')
^ ^ remove these ones
You use a lot of unnecessary parentheses. Removing these makes it easier to spot mismatches.
figure
plot(V_X(1,:),V_X(2,:),'k')
hold on
title('--------',int2str(n))
plot(matrixV(1,:),matrixV(2,:),'--r*')
hold off