MATLAB Answers

# I have a code and it keep saying "invalid expression. when calling a function or indexing a variable, use parentheses. otherwise check for mismatched delimiters.

1 view (last 30 days)
Bevey on 3 May 2021
Commented: Bevey on 3 May 2021
i1 = 1.11 * 10^-3;
i2 = - 7.4 * 10^-3;
i3 = 1.85 * 10^-3;
syms i1 i2 i3
eq1 = 2000 * i1 + 1500 * i3;
eq2 = 3000 * i2 - 1500 * i3;
eq3 = i1 - i2 -i3;
[A, B] = equationsToMatrix([eq1, eq2, eq3, [i1, i2, i3]);
x = linsolve(A, B);
x = [i1, i2, i3];
##### 0 CommentsShowHide -1 older comments

Sign in to comment.

### Accepted Answer

the cyclist on 3 May 2021
Edited: the cyclist on 3 May 2021
This line is where the problem is ...
[A, B] = equationsToMatrix([eq1, eq2, eq3, [i1, i2, i3]);
Inside the parentheses, you have unpaired square brackets.
##### 1 CommentShowHide None
Bevey on 3 May 2021
Lol, I didn't noticeǃ Thank you.

Sign in to comment.

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!