Error using sym/subsindex , Error in sym/subsref

4 visualizzazioni (ultimi 30 giorni)
Ege Alp TURKYENER
Ege Alp TURKYENER il 15 Mag 2020
Risposto: Ameer Hamza il 15 Mag 2020
syms Ybus k n V i N;
V(k,i) = (1/Ybus(k,k))*((conj(S(k)))/(conj(V(k,i)))-(symsum(Ybus(k,n)*V(n,i+1),n,1,k-1)) -(symsum(Ybus(k,N)*V(N,i),n,k+1,N)));
Error using sym/subsindex (line 855)
Invalid indexing or function definition. Indexing must follow MATLAB indexing. Function arguments must be symbolic variables, and function body must be sym
expression.
Error in sym/subsref (line 900)
R_tilde = builtin('subsref',L_tilde,Idx);
Error in hmw (line 28)
V(k,i) = (1/Ybus(k,k))*((conj(S(k)))/(conj(V(k,i)))-(symsum(Ybus(k,n)*V(n,i+1),n,1,k-1)) -(symsum(Ybus(k,N)*V(N,i),n,k+1,N)));
Where is the problem ?

Risposte (1)

Ameer Hamza
Ameer Hamza il 15 Mag 2020
You are using Ybus, S, and V as functions, however, you defined them as simple symbolic variables. Try this
syms Ybus(k,n) V(k,i) N S(k)
V(k,i) = (1/Ybus(k,k))*((conj(S(k)))/(conj(V(k,i)))-(symsum(Ybus(k,n)*V(n,i+1),n,1,k-1)) -(symsum(Ybus(k,N)*V(N,i),n,k+1,N)));
Also, here you are defining V(k,i) in terms of V(k,1). It appears there might be a logical error. Can you show the equation you are trying to implement?

Community Treasure Hunt

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

Start Hunting!

Translated by