how to use indexing in subs command? Here is the program i am trying..i want to have mu for each iteration which is a function of a,b,c which depend on iteration...I have listed the errors cropped up.
    7 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
clc
clear all
for i=1:4
syms a b c
i;
g=a+b-c;
 a(i)=1+i; 
 b(i)=2+i;
 c(i)=3+i;
mu(i)=subs(g,{a,b,c},{a(i),b(i),c(i)});
end
??? Error using ==> sym.subs>flatten at 291
Number of elements in NEW must match number in OLD
Error in ==> sym.subs>mupadsubs at 149
[X,Y] = flatten(X,Y);
Error in ==> sym.subs at 124
G = mupadsubs(F,X,Y);
0 comentarios
Respuestas (1)
  Zhang lu
      
 el 21 de Abr. de 2013
        
      Editada: Walter Roberson
      
      
 el 21 de Abr. de 2013
  
      clc 
clear all
syms a b c 
g=a+b+c;
i=1:4;
A=1+i;
B=2+i;
C=3+i;
mu=subs(g,{a,b,c},{A,B,C})
0 comentarios
Ver también
Categorías
				Más información sobre Matrix Indexing en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

