How Can I define a Polynomial of degree n with symbolic coefficients?
    7 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Ethen
 el 25 de Feb. de 2014
  
    
    
    
    
    Comentada: Ethen
 el 25 de Feb. de 2014
            Hi guys, How can I define a polynomial of degree n with symbolic coefficients. For example, if n=2, P= ax*2+bx+c
Thanks
0 comentarios
Respuesta aceptada
  John D'Errico
      
      
 el 25 de Feb. de 2014
        
      Editada: John D'Errico
      
      
 el 25 de Feb. de 2014
  
      Whats the problem? This seems clear.
syms x a b c
P = a*x^2+b*x+c;
Are you looking for a general solution for any n? This seems to work:
n = 3;
syms x
P = sym('a',[1,n+1])*x.^(n:-1:0).'
P = 
  a1*x^3 + a2*x^2 + a3*x + a4
Más respuestas (0)
Ver también
Categorías
				Más información sobre Polynomials 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!

