. , . MatLab .
% 1 ( )
clear
E=0.01; %
n=3; %
y=200; %
Xm=20; %
x=0.1:0.2:Xm; %
R='((x+1).^n-1)./x'; %
f = inline(R); %
plot(x,f(n,x),'DisplayName','F','YDataSource','F') % %
% 1:
x1=Xm; % 1:=Xm
while(f(n,x1)>y) % - f(xl) >
x1=x1/2; % 1:=1/2
end %-
% 2:
x2=0.1; % 2:=0.1
while(f(n,x2)<y) % - f(x2) <
x2=x2*2; %2:= 2*2
end %-
% :
while(x2-x1>E) % - 2-1 > E
xt=(x1+x2)/2; % xt:=(xl +2)/2
if f(n,xt)>y % f(xt) >
x2=xt; % 2:= xt
else % 1:= xt
x1=xt;
end % -
end % -
at=f(n,x1); %
%
%
clear
global f
f = in_fun();
y=0;
while(y==0)
[ E,n,Xm,y] = in_dat();
end
x=0.1:0.2:Xm;
F=f(n,x);
plot(x,f(n,x))
x1=Xm;
while(f(n,x1)>y)
x1=x1/2;
end
x2=0.1;
while(f(n,x2)<y)
x2=x2*2;
end
while(x2-x1>E)
xt=(x1+x2)/2;
if f(n,xt)>y
x2=xt;
else
x1=xt;
end
end
at=f(n,x1);
out_x(at,y,x1)
:
function [ f] = in_fun()
%
global f
R=input(' ( !!!)\n','s');
f = inline(R);
end
function [ E,n,Xm,y] = in_dat()
%
R=input(' \n','s');
E=str2double(R);
R=input(' \n','s');
n=str2double(R);
R=input(' Xm\n','s');
Xm=str2double(R);
R=input(' ?\n','s');
y=str2double(R);
if y>f(n,Xm)
disp('! !')
y=0;
end
end
function [ ] = out_x(a,y,x)
%
fprintf(' y=%d\n',y)
fprintf(' x=%d\n',x)
fprintf(' %d\n',a)
end
:
1. .
.
2. .
, .
3. :
;
;
|
|
;
;
;
;
.
5. .
, .
6. .
, . : , , , , .. . . .
,
1.
; , .
.
1. .. : .-.: - . .., 2001;
2. .. MATLAB: / .. .- .., 2006;
3. .. . . - ., 1982, 552 ., [ 519.6/8,-19]
4. .. : - ., , 1982,254 .;
5. .. . , - ., ,1987,288 .,;
6. .. , , . - , "",1992,406 .;
7. .., .., .. . . -., ,1986.
8. . ., . ., . . . . . / . . . .: . . 2000. 190 .
9. , . . MATLAB 7.*/R2006/R2007: . .: , 2008. 767 .
1.
-
..-.., | . . | |||
, . , | , | , |
- | ||||||||||||
- 2012 | ||||||||||||
[1] .
|
|