how to input the Equations which has some variables

syms v1 v2 v3 c1 c2 c3 e1 e2 e3 c1=0; c2=0; c3=0; v=[v1; v2; v3; ]; c=[c1; c2; c3; ]; e=[e1; e2; e3; ]
r=[0 5 3; 5 0 4; 3 4 0]; %r(3,2)
for i=1:3 for j=1:3 if(i~=j) c(i)=c(i)+(v(i)-v(j))/r(i,j); % error!!! end end e(i)=c(i); end
for i=1:3 e(i) end
What can I do about the error?
The following error occurred converting from sym to double: Error using mupadmex Error in MuPAD command: DOUBLE cannot convert the input expression into a double array.
If the input expression contains a symbolic variable, use the VPA function instead.
Error in equivalent_resistance_matrix (line 22) c(i)=c(i)+(v(i)-v(j))/r(i,j); % If the input expression contains a symbolic variable, use the VPA function instead.

Answers (1)

I want to get these equations. (v1-v2)/5+(v1-v3)/3=1 (v2-v1)/5+(v2-v3)/4=0 (v3-v1)/3+(v3-v2)/4=0 But not input equation one by one

Asked:

on 15 Oct 2014

Answered:

on 15 Oct 2014

Community Treasure Hunt

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

Start Hunting!