matlab的函数的拟合和求导答:dp=polyder(p)%导函数 tt=linspace(-.05,0.2);plot(t,y,'ro');hold on a=plotyy(tt,polyval(p,tt),tt,polyval(dp,tt));legend('样本点','拟合曲线','location','southwest')a=legend(a(2),'导函数','location','southeast');set(a,'color','w')———那就再对dp求导 d2p=p...
matlab 在曲线上画其切线的问题答:1)-1);%我随便给出的xy值你可以改plot(x,y,'r-')p = polyfit(x,y,2);ynew = polyval(p,x);hold onplot(x,ynew,'g-')p1 = polyder(p);% 求x0 y0处的切线x0 = 10;y0 = polyval(p,x0);y01 = polyval(p1,x0);y1 = y01*(x-x0)+y0;plot(x,y1,'b-')legend(...