Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clc
- clear all
- close all
- format compact
- fi=[1 1/2 1/3 1/4;
- 1/2 1/3 1/4 1/5;
- 1/3 1/4 1/5 1/6;
- 1/4 1/5 1/6 1/7];
- F=[2/3; 2/5; 2/7; 2/9];
- A=fi\F;
- figure(1)
- x=0:0.01:1;
- P=A(1)+A(2)*x+A(3)*x.^2+A(4)*x.^3;
- plot(x,P,'r+')
- hold on
- R=sqrt(x);
- plot(x,R,'-')
- hold on
- E=zeros(1,101)
- for i = 1:101
- E(i) = (P(i)- R(i))^2;
- end
- % E=(P-R).^2; wyzszy level
- indexmin = find(min(E) == E);
- xmin = x(indexmin);
- Emin = E(indexmin);
- figure (2)
- plot(x,E,'g')
- hold on
- plot(xmin,Emin,'r*')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement