Function instead of polyval
Ältere Kommentare anzeigen
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.
Akzeptierte Antwort
Weitere Antworten (1)
Azzi Abdelmalek
am 7 Aug. 2012
Bearbeitet: Azzi Abdelmalek
am 7 Aug. 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 Kommentare
Yash
am 7 Aug. 2012
Azzi Abdelmalek
am 7 Aug. 2012
ok try this
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
Yash
am 7 Aug. 2012
Yash
am 7 Aug. 2012
Kategorien
Mehr zu MATLAB finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!