MATLAB 习题实验报告
。
(3)
>> @(x)exp(x./2);
ans = @(x)exp(x./2)
>> f=@(x)exp(x./2);
>> [q,fcont]=quad(f,2,6)
q =
fcont =
37
>>
(4)
>> f=@(x)x./(x.^4+4);
>> [q,fcont]=quad(f,1,10)
q =
fcont =
41
>>
(5)
>> f=@(x,y)sin(y).*(x+y)./(x.^2+4);
>> dblquad(f,1,10,1,10)
ans =
>>
2,求下列函数的极值。
(3) ,
创建文件z,该文件的内容如下:
function f=z(x)
f=sin(x(1))+cos(x(2))+cos(x(1)-x(2));
>> hf=***@z;
>> [x,fvalue,flag,output]=fminsearch(hf,[-2,2])
x =
-
fvalue =
-
flag =
1
output =
iterations: 34
ount: 65
algorithm: 'Nelder-Mead simplex direct search'
message: [1x196 char]
,并绘制图形。
(1),初始点为x=8
>> f_h=@(x)exp(x)-x.^5;
>> [x1,y1]=fzero(f_h,8)
x1 =
y1 =
0
>> fplot(f_h,[x1+2,x1-2])
>> hold on
>> plot(x1,y1,'k*')
(2)
>> h_f=@(x)x.*sin(x);
>> [x,y]=fzero(h_f,0)
x =
0
y =
0
>> fplot
matlab 习题实验报告 来自淘豆网m.daumloan.com转载请标明出处.