1, polyval ()% polynomial constructors, parameters vector vectors, vector independent variables
f=[9,-5,3,7]; X=-2:0.01:5; The range of%x is 2 to 5
Y=polyval (F,X); %x is an argument range and F is a polynomial coefficient
Plot (x, y, ' linewidth ', 2);
Xlabel (' x '); Ylabel (' Y ');
Set (GCA, ' fontsize ', 14);
2, Polyder ()% derivative
P=[5 0-2 1]; %5x^4-2x^2+x
Polyder (P); % result is 20 0-4 0
3, when x=7, the guide value
P=[5 0-2 1]; %5x^4-2x^2+x
Polyval (Polyder (P), 7);
4, Conv ()% is used to denote multiple 20x^3+7x^2 of f (x) = (x^3+4x)
Product of
Y1=[20 7 0 0]; Y2=[1 0 4 0];
F=conv (Y1,Y2);
5, Polyint ()% gives indefinite integral a definite constant term k, ...
F (x) =x+4; 1/2x^2+4x+k the integral to it.
P=[5 0-2 0 1]; %f (x)
Polyint (p,3); % constant term k is 3 after given integral
Polyval (Polyint (p,3), 7); % calculates the integral of F (7)
6, diff ()% vector difference of neighboring elements, used to calculate slope
X=[1 2]; Y=[5 7]; %X1,X2 Y1,y2
Slope=diff (Y)./diff (x); % calculates the slope of the point (1,5) (2,7)
7. Calculate the derivative within the entire defined field
h=0.5; X=0:h:2*pi;
Y=sin (x); M=diff (y)./diff (x); % Compute sin ' (x)
8. Calculate two differential, three differential
X=-2:0.005:2; y=x.^3;
M=diff (y)./diff (x); % First-order guide
M2=diff (M)./diff (x (1:end-1)); The dimensions of the%m are 1 less than x, and the second-order guide
Plot (X,y,x (1:end-1), M,x (1:end-2), m2);
Legend (' F (x) ', ' F ' (x) ', ' F ' (x) '); % do image callout
9, calculate the definite integral, calculate the integral of 4x^3 in interval [0,2] by using differential rectangle summation
h=0.05; X=0:h:2;
Midpoint= (x (1:end-1) +x (2:end))./2; % calculates the midpoint of each rectangle (xmid)
y=4*midpoint.^3; % result is 15.99
S=sum (H*y); % of all trapezoidal bottom multiply high sum
10, Trapz () Calculate the definite integral, use trapezoid accumulation
h=0.05; X=0:h:2; y=4*x.^3; The%h is a trapezoidal high
S=h*trapz (y); % result is 16.01
11, Integral2 double integral integral3 triple integral
[Email protected] (x, Y) y.*sin (×) +8.*cos (y); % of functions to be integral
Integral2 (F,PI,2*PI,0,PI); The% parameters are: function, first level integration interval, second level integration interval
Integral3 (f,0,pi,0,1,-1,1);
Matlab numerical calculus