ace8957 Light Poster

I am trying to solve a system of 5 equations in 5 unknowns. I am new to the Matlab language. I consulted the documentation and decided that the best way of doing this was to use the solve() function. However, this function does not appear to work properly for 5 unknowns. It is an electrical problem, and I am trying to solve for 5 currents, i1, i2, i3, i4, and i5. However, the function does not recognize v2 as a constant attempts to solve for it, neglecting i5. The code is as follows:

v2 = 1;
syms i1 i2 i3 i4 i5;
S = solve('-100 + 5*i1 + 150*i4 = 0','-150*i4 + 100*i2 + 250000*i5 = 0','-250000*i5 + 200*i3 + v2 = 0','i1 = i2+i4','i2 = i3 + i5');

The matrix S is as follows:

S =

i1: [1x1 sym]
i2: [1x1 sym]
i3: [1x1 sym]
i4: [1x1 sym]
v2: [1x1 sym]

Instead of solving for i5, it attempts to solve for v2. I do not understand what is causing this. Any input would be greatly appreciated.