Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %% Example 1. Newton interpolating polynomial
- clear all, clc ,close all, format compact, format
- xnodes=[1:7]; ynodes=[2.3,3.4,5.1,6.3,7.5,8.2,7.4];
- ๐ ๐๐, ๐๐ =
- ๐๐ โ ๐๐
- ๐๐ โ ๐๐
- โฆโฆ โฆ. โฆ.
- ๐ ๐๐, ๐๐, ๐๐ =
- ๐ ๐๐, ๐๐ โ ๐ ๐๐, ๐๐
- ๐๐ โ ๐๐
- โฆโฆ โฆ. โฆ.
- 4
- Newton interpolating polynomial
- coef=ynodes; % determination of ๐๐, ๐๐, โฆ
- for k = 2:7
- coef(k:7) = (coef(k:7) - coef(k-1:6))./โฆ
- (xnodes(k:7) - xnodes(1:8-k));
- end
- syms x
- pol= coef(7); % coefficients of the polynomial
- for k = 6:-1:1
- pol=pol*(x-xnodes(k))+coef(k);
- end
- ๐๐ ๐๐ ๐ ๐๐
- , ๐๐+๐ ๐ ๐๐
- , ๐๐+๐, ๐๐+๐ ๐ ๐๐
- , ๐๐+๐, ๐๐+๐, ๐๐+๐
- ๐๐ ๐๐ = ๐๐
- ๐๐ = ๐ ๐๐, ๐๐
- ๐๐ ๐๐ ๐๐ = ๐ ๐๐, ๐๐, ๐๐
- ๐ ๐๐, ๐๐ ๐๐ = ๐ ๐๐, ๐๐, ๐๐, ๐๐
- ๐๐ ๐๐ ๐ ๐๐, ๐๐, ๐๐
- ๐ ๐๐, ๐๐
- ๐๐ ๐๐
- polyn=collect(pol)
- coefpol=sym2poly(polyn) % coefficients of the polynomial (format double)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement