[MATLAB]专题六单元作业(数值微积分与方程求解)答案

本试验取材于中南大学《科学计算与MATLAB语言》,话不多说上代码
[MATLAB]专题六单元作业(数值微积分与方程求解)答案_第1张图片

>> f=@(x) sqrt(cos(x.*x)+1);

>> [I,n]=quad(f,0,2*pi);

>> I

I =


    6.0401

>> 

[MATLAB]专题六单元作业(数值微积分与方程求解)答案_第2张图片

>> f=@(x) [sin(x(1))+(x(2))^2+log(x(3))-7;2*x(1)+3*x(1)+2^(x(2))-(x(3))^3+1;x(1)+x(2)+x(3)-5];

>> x=fsolve(f,[1,1,1],optimset('Display','off'))

x =

    0.5248    2.4021    2.0731

>> 

[MATLAB]专题六单元作业(数值微积分与方程求解)答案_第3张图片

>> [x,fval]=fminbnd(@(x) (x^3+cos(x)+x.*log(x))/exp(x),0,1)

Warning: Log of zero.

> In @(x) (x^3+cos(x)+x.*log(x))/exp(x)

  In fminbnd at 176

x =

    0.5223

fval =

    0.3974

>> [x,fval]=fminbnd(@(x) ((-x)^3+cos(-x)+x.*log(-x))/exp(-x),0,1)

Warning: Log of zero.

> In @(x) ((-x)^3+cos(-x)+x.*log(-x))/exp(-x)

  In fminbnd at 176

x =

     1


fval =

  -1.2496 + 8.5397i

>> 

[MATLAB]专题六单元作业(数值微积分与方程求解)答案_第4张图片

>> syms x y

>> y=dsolve('D2y-3*Dy+2*y-1=0','y(0)=1','Dy(0)=0')
 

y =


1/2-1/2*exp(2*t)+exp(t)

 

>> 

你可能感兴趣的:(数学建模)