Ejercicios Scilab Completo
Upcoming SlideShare
Loading in...5
×
 

Ejercicios Scilab Completo

on

  • 19,186 views

ejercicios con los resultados, excepto el punto de la falsa posición porque me genera un error del programa

ejercicios con los resultados, excepto el punto de la falsa posición porque me genera un error del programa

Statistics

Views

Total Views
19,186
Views on SlideShare
19,186
Embed Views
0

Actions

Likes
3
Downloads
614
Comments
3

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • el de punto fijo te da un valor extraño
    Are you sure you want to
    Your message goes here
    Processing…
  • gracias culo
    Are you sure you want to
    Your message goes here
    Processing…
  • excelent
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Ejercicios Scilab Completo Ejercicios Scilab Completo Document Transcript

  • Ricardo Adolfo Grandas Código: 2305014 Ejercicios en Scilab 1) Método de Biseccion function y=f(x) y=-12.4+10*(0.5*%pi-asin(x/1)-x*(1-x**2)**0.5); endfunction function xr=biseccion(xai,xbi,tol) i=1; ea(1)=100; if f(xai)*f(xbi) < 0 xa(1)=xai; xb(1)=xbi; xr(1)=(xa(1)+xb(1))/2; printf('It.tt Xatt Xbtt Xrtt f(Xr)t Error n'); printf('%2d t %11.7f t %11.7f t %11.7f t %11.7f n',i,xa(i),xb(i),xr(i),f(xr(i))); while abs(ea(i)) >= tol if f(xa(i))*f(xr(i))< 0 xa(i+1)=xa(i); xb(i+1)=xr(i); end if f(xa(i))*f(xr(i))> 0 xa(i+1)=xr(i); xb(i+1)=xb(i); end xr(i+1)=(xa(i+1)+xb(i+1))/2; ea(i+1)=abs((xr(i+1)-xr(i))/(xr(i+1))); printf('%2d t %11.7f t %11.7f t %11.7f t %11.7f t %7.6f n',i+1,xa(i+1),xb(i+1),xr(i+1),f(xr(i+1)),ea(i+1)); i=i+1; end else printf('No existe una raíz en ese intervalo'); end endfunction
  • 2) Método Newton-Raphson function y=f(x) y=2*x**3+x-1; endfunction function y=df(x) y=6*x**2+1; endfunction function x=newtonraphson(x0,tol); i=1; ea(1)=100; x(1)=x0; while abs(ea(i))>=tol; x(i+1)=x(i)-f(x(i))/df(x(i)); ea(i+1)=abs((x(i+1)-x(i))/x(i+1)); i=i+1; end printf(' i t X(i) Error aprox (i) n'); for j=1:i; printf('%2d t %11.7f t %7.6f n',j-1,x(j),ea(j)); end endfunction
  • 3) Iteración Punto Fijo function y=g(x) y=300-80.425*x+201.0625*(1-exp(-(0.1)*x/0.25)); endfunction function x=puntofijo(x0,tol) i=1; ea(1)=100; x(1)=x0; while abs(ea(i))>=tol, x(i+1) = g(x(i)); ea(i+1) = abs((x(i+1)-x(i))/x(i+1)); i=i+1; end printf(' i t X(i) Error aprox (i) n'); for j=1:i; printf('%2d t %11.7f t %7.3f n',j-1,x(j),ea(j)); end endfunction
  • 4) a- Newton function y=f(x) y=4*cos(x)-exp(x); endfunction function y=df(x) y=-4*sin(x)-exp(x); endfunction function x=newtonraphson(x0,tol); i=1; ea(1)=100; x(1)=x0; while abs(ea(i))>=tol; x(i+1)=x(i)-f(x(i))/df(x(i)); ea(i+1)=abs((x(i+1)-x(i))/x(i+1)); i=i+1; end printf(' i t X(i) Error aprox (i) n'); for j=1:i; printf('%2d t %11.7f t %7.6f n',j-1,x(j),ea(j)); end endfunction
  • b- Secante function y=f(x) y=4*cos(x)-exp(x); endfunction function x = secante(x0,x1,tol) j=2; i=1; x(1)=x0; x(2)=x1; ea(i)=100; while abs(ea(i))>=tol x(j+1)=(x(j-1)*f(x(j))-x(j)*f(x(j-1)))/(f(x(j))-f(x(j-1))); ea(i+1)=abs((x(j+1)-x(j))/x(j+1)); j=j+1; i=i+1; end printf(' i tt x(i) t Error aprox (i) n'); printf('%2d t %11.7f t n',0,x(1)); for k=2:j; printf('%2d t %11.7f t %7.3f n',k-1,x(k),ea(k-1)); end endfunction
  • 5) a- Secante function y=f(x) y=x**2-6; endfunction function x = secante(x0,x1,tol) j=2; i=1; x(1)=x0; x(2)=x1; ea(i)=100; while abs(ea(i))>=tol x(j+1)=(x(j-1)*f(x(j))-x(j)*f(x(j-1)))/(f(x(j))-f(x(j-1))); ea(i+1)=abs((x(j+1)-x(j))/x(j+1)); j=j+1; i=i+1; end printf(' i tt x(i) t Error aprox (i) n'); printf('%2d t %11.7f t n',0,x(1)); for k=2:j; printf('%2d t %11.7f t %7.3f n',k-1,x(k),ea(k-1)); end endfunction
  • b- Falsa Posición function y=f(x) y=x**2-6; endfunction function xr=reglafalsa(xai,xbi,tol) i=1; ea(1)=100; if f(xai)*f(xbi) < 0 xa(1)=xai; xb(1)=xbi; xr(1)=xa(1)-f(xa(1))*(xb(1)-xa(1))/(f(xb(1))-f(xa(1))); printf('It. Xa Xb Xr f(Xr) Error aprox %n'); printf('%2d t %11.7f t %11.7f t %11.7ft %11.7f n',i,xa(i),xb(i),xr(i),f(xr(i))); while abs(ea(i))>=tol, if f(xa(i))*f(xr(i))< 0 xa(i+1)=xa(i); xb(i+1)=xr(i); end if f(xa(i))*f(xr(i))> 0 xa(1)=xr(i); xb(1)=xb(i); end xr(i+1)=xa(i+1)-f(xa(i+1))*(xb(i+1)-xa(i+1))/(f(xb(i+1))-f(xa(i+1))); ea(i+1)=abs((xr(i+1)-xr(i))/(xr(i+1))); printf('%2d t %11.7f t %11.7f t %11.7f t %11.7ft %7.3f n', i+1,xa(i+1),xb(i+1),xr(i+1),f(xr(i+1)),ea(i+1)); i=i+1; end else printf('No existe una raíz en ese intervalo'); end endfunction