Advertisement
codisinmyvines

task3

Mar 23rd, 2022
937
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function y = Degenerate_Fred_II_Taylor(K,f,a,b,lambda,power)
  2.     [alpha, beta]=coeffs(taylor(K,'Order',power+1),x);
  3.     for i = 1:length(alpha)
  4.         s = char(alpha(i));
  5.         s(1,1)='x';
  6.         alpha(i)=s;
  7.     end
  8.     n=numel(alpha);
  9.     A=zeros(n);
  10.     for j=1:n
  11.         A(:,j)= -lambda*int(beta*alpha(j),a,b);
  12.         A(j,j)=1+A(j,j);
  13.     end
  14.     r=int(beta*f,a,b)';
  15.     c=A\r;
  16.     y=dot(c,alpha)*lambda+f;
  17. end
Advertisement
RAW Paste Data Copied
Advertisement