Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clc
- vX = [-0.3 0.1 0.5 0.9 1.3 1.7 2.1];
- vY = [-1.3 2.2 3.5 5.8 7.2 6.0 5.8];
- X=1.43;
- vTemp=[0 0 0 0 0 0 0]
- j=1;
- i=1;
- n=7;
- Px=0;
- xi=vX(1);
- xii=vX(1);
- x0=vX(1);
- y0=vX(1);
- Ptmp=1;
- for i = 1:n;
- yi=vY(i);
- xii=vX(i);
- for j = 1:n;
- xi=vX(j);
- if (xii<>xi) then
- Ptmp=Ptmp*((X-xi)/(xii-xi));
- end
- end
- Px=Px+Ptmp*yi
- vTemp(i)=Px;
- Ptmp=1;
- end
- Px
- vTemp
- plot2d(vX, vTemp, style=[color("magenta")], leg="Лагранж");
- d=splin(vX,vTemp);
- S=interp(-0.3:0.01:2.1, vX,vTemp,d);
- plot2d(vX',vTemp',-1);
- plot2d((-0.3:0.01:2.1)',S',9,'000')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement