Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %Métodos Numericos
- %
- %
- clc
- clear all;
- f=inline('(exp(-sin(8*x)))');
- a=0;
- b=3.5;
- k=18; %3,4,6
- %a=-pi;b=pi;
- %k=8
- h=(b-a)/(2*k);
- s1=0; %se establecen dos sumadores
- s2=0;
- for i=1:2*k-1
- if rem(i,2)==1
- s1=s1+f(a+i*h); %sumando impares
- else
- s2=s2+f(a+i*h); %sumando pares
- end
- end
- syms z
- vexacto=double(int(f(z),a,b)) %se calcula el valor exacto de la integral
- IS1_3=h/3*(f(a)+4*s1+2*s2+f(b)) %simpson 1/3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement