using polyval(a,x)
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi guys please help me I cant seem to figure out how to use polyval(a,x), I need to use it to solve the following problem:
1.) Confirm that 6x^3+4x^2-5/12x^3-7x^2+3x+9=0.7108 when x=2;
please help me. thanks
0 Kommentare
Antworten (2)
Sean de Wolski
am 15 Aug. 2011
It doesn't
fzero(@(x)6*x^3+4*x^2-5/12*x^3-7*x^2+3*x+8.2892,pi)
0 Kommentare
Paulo Silva
am 15 Aug. 2011
%first way to find if the equality is correct
f=@(x) (-5/12+6)*x^3+(-7+4)*x^2+3*x+9;
f(2)
%second way
polyval([-5/12+6 -7+4 3 9],2)
%yet another way that only works if you have the symbolic toolbox
syms x
f=6*x^3+4*x^2-5/12*x^3-7*x^2+3*x+9;
subs(f,x,2)
every way gives the value 47.666666666666664 not 0.7108, so it's not confirmed, the assumption is wrong.
f=@(x) (-5/12+6)*x^3+(-7+4)*x^2+3*x+9;
ezplot(f,[0 4])
hold on
line(xlim,[0.7108 0.7108],'color',[1 0 0])
line([2 2],ylim,'color',[1 0 0])
plot(2,f(2),'o','linewidth',4,'markersize',10)
text(2,f(2),['\leftarrow' 'x=2 and y=' num2str(f(2))],'FontSize',18)
text(2,0.7108,['\leftarrow' 'x=2 and y=' '0.7108'],'FontSize',18)
2 Kommentare
Siehe auch
Kategorien
Mehr zu Function Creation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!