Baixe o app para aproveitar ainda mais
Esta é uma pré-visualização de arquivo. Entre para ver o arquivo original
function y=fv(f,x) N=length(x); y=zeros(N,1); for i=1:N y(i)=f(x(i)); end endfunction function [I]=gauss(f,x,a,b) [As]=pesos(x) t=(b+a)/2+(b-a)/2*x p=fv(f,t) I=(b-a)/2*(p'*As) endfunction function [x]=raizes_legendre(N) x=poly(0,'x') p=(x^2-1)^N for i=1:N p=derivat(p) end x=roots(p)' endfunction function [As]=pesos(x) N=length(x) A=zeros(N,N) B=zeros(N,1) for i=1:N A(i,:)=x.^(i-1) end for i=1:2:N B(i)=2/i end As=A\B endfunction //se quero encontrar gauss legendre faço primeiro //[x]=raizes_legendre(N) aonde N é igual ao ponto 2, 3 ,4 //[I]=gauss(f,raizes_legendre(2),a,b)
Compartilhar