Function instead of polyval
    8 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
Is there a Matlab built in function that can be used instead of a polyval function. Or any few lines can work similarly like the polyval function because i dont want to use the polyval function.
0 comentarios
Respuesta aceptada
  Sean de Wolski
      
      
 el 7 de Ag. de 2012
        fnotpolyval = @(p,x)sum(bsxfun(@(x,p)p*x.^(numel(p):-1:1),p',x))
or
fnotpolyval = @(p,x)sum(x'*p,2)'
2 comentarios
Más respuestas (1)
  Azzi Abdelmalek
      
      
 el 7 de Ag. de 2012
        
      Editada: Azzi Abdelmalek
      
      
 el 7 de Ag. de 2012
  
         fval=@(p,x) sum((x.^[length(p)-1:-1:0].*p));
   %example 
   p=[2 4 5 3]; x=2;
   result=fval(p,x)   % fval is your new function
4 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


