10.05.2013 Views

texto: metodos numericos para ecuaciones diferenciales ordinarias

texto: metodos numericos para ecuaciones diferenciales ordinarias

texto: metodos numericos para ecuaciones diferenciales ordinarias

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

x=-pi:0.1:pi;<br />

>> y=x.*cos(x);<br />

>> plot(x,y);<br />

>>grid<br />

>> hold on %Mantiene en la ventana gráfica los dibujos anteriores<br />

>> fplot(’sin(x)’,[-pi pi]) % Dibuja sobre la gráfica anterior<br />

4<br />

3<br />

2<br />

1<br />

0<br />

−1<br />

−2<br />

−3<br />

% la función sin(x)<br />

−4<br />

−3 −2 −1 0 1 2 3<br />

A.3 Programación<br />

Figura 1: Gráfica de xcos(x) y sin(x)<br />

1. Calcule la suma de los n primeros términos de la sucesión x, 2x 2 , 3x 3 ,· · · nx n <strong>para</strong><br />

un valor de x,<br />

Programa sumas.m<br />

n=input(’ingrese cuantos términos quiere sumar’);<br />

x=input(’dame el valor del numeros x’);<br />

suma=x;<br />

for i=2:n<br />

67

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!