- 博客(4)
- 收藏
- 关注
原创 个人作业插值
牛顿插值disp(Newton_fun(2010));x=linspace(1994,2010);y=zeros(1,100);for i=1:100 y(i)=Newton_fun(x(i));endplot(x,y);function sum= Newton_fun(x)newton=ones(10);X=[1994,1995,1996,1997,1998,1999,2000,2001,2002,2003];Y=[67.052,68.008,69.803,72.024,73..
2021-06-07 00:47:26 127
原创 MatLab(3)
function[y] = Lagrange(x)a = [25 40 50 60];b = [95 75 63 54];n = 4;sum = 0;for k = 1:n pro = 1; for i = 1:n if i ~= k pro = pro * (x - a(i))/(a(k) - a(i)); end end sum = sum + b(k) * pro;endy = sum;end...
2021-06-07 00:15:39 132
原创 MatLab(1)
二分法function[X, N] = dichotomy(e, a, b, f)%二分法N = fix(log2((b - a) / e)) + 1;%迭代次数n = 1;x = 0;fa = f(a);fb = f(b);if fa * fb > 0 disp('根不在给的区间内');else while n <= N x = (a + b) / 2; if f(a)*f(x) > 0 a =...
2021-06-06 22:39:00 140
原创 MatLab(2)
function[x] = gauss(A,b)n = size(A,1);x = zeros(n,1);for k = 1 : n-1 for i = k+1 : n t = A(i,k)/A(k,k); for j = k+1 : n A(i,j) = A(i,j) - t * A(k,j); end b(i) = b(i) - t * b(k); endendx(n) = b(n)/A(n...
2021-06-06 22:33:25 137
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人