文件名称:Estimating19609112312005
介绍说明--下载内容均来自于网络,请自行研究使用
Simple exercise that calculate the Taylor expansion of the exponential
function.
Input variables: degree N
vector of evaluation points, x
At each step plots the Taylor polynomial and compare with the real
function
function y=taylor_exp(N,x)
printf("Order of the expansion: d ", N)
size(x)
y=ones(size(x))
plot(x,y,"r-",x,exp(x),"b-")
legend("n=0,exp(x)")
for n=1:N
y+=(1/factorial(n))*(x.^n)
plot(x,y,"r-",x,exp(x),"b-")
xlabel("x")
ylabel("f(x)")
legend("approx","exp(x)")
pause
end
endfunction
-
Simple exercise that calculate the Taylor expansion of the exponential
function.
Input variables: degree N
vector of evaluation points, x
At each step plots the Taylor polynomial and compare with the real
function
function y=taylor_exp(N,x)
printf("Order of the expansion: d ", N)
size(x)
y=ones(size(x))
plot(x,y,"r-",x,exp(x),"b-")
legend("n=0,exp(x)")
for n=1:N
y+=(1/factorial(n))*(x.^n)
plot(x,y,"r-",x,exp(x),"b-")
xlabel("x")
ylabel("f(x)")
legend("approx","exp(x)")
pause
end
endfunction
(系统自动生成,下载前可以参看下载内容)
下载文件列表
@PSC_ReadMe_5109_2.txt
pi
..\.classpath
..\.project
..\pi.htm
..\PIApplet.class
..\PIApplet.java
pi
..\.classpath
..\.project
..\pi.htm
..\PIApplet.class
..\PIApplet.java