- Given ,plot the approximate derivatives of =0.1,0.01,0.001 ```matlab g = colormap(lines); hold on; for i = 1:3 x = 0:power(10,-i):2 pi; y = exp(-x) . sin(power(x,2) ./ 2);%不能直接用x^2/2 m = diff(y) ./ diff(x); plot(x(1:end-1),m,’Color’,g(i,:)); end hold off
set(gca,’XLim’,[0,2pi]); set(gca,’YLim’,[-0.3,0.3]); set(gca,’FontSize’,18); %set(gca,”FontName”,’symbol’);%R2018不用设置字体 set(gca,’XTick’,0:pi/2:2pi); set(gca,’XTickLabel’,{‘0’,’\pi/2’,’\pi’,’3\pi/2’,’2\pi’});%将数字变为pi形式 h = legend(‘h = 0.1’,’h = 0.01’,’h = 0.001’); set(h,’FontName’,’Times New Roman’); box on
2. Excise:
![](https://cdn.nlark.com/yuque/0/2021/svg/12945069/1631432089931-96180163-e2fd-45c1-859c-bb1c4c9b6cd2.svg#clientId=u966cd526-b9fd-4&from=paste&id=u2bd27d58&margin=%5Bobject%20Object%5D&originHeight=56&originWidth=168&originalType=url&ratio=1&status=done&style=none&taskId=u54dd0e01-67f7-4037-b425-74947dd2758)
```matlab
syms x;
f = (x^2-x+1) / (x+3);
Fint = int(f,x,[0 10])%注意定积分的求法