> If you try > M-x set-variable RET fill-column RET > 150 Consider
#+begin_src
function [teuler,yeuler,ev]=mieulerimpfixpc(f,intv,y0,N,TOL,nmax) % se
implementa el tercer tipo de función dada por el enunciado
a = min(intv); % se
preparan los datos de la mísma forma como se ha comentado en la anterior función
b = max(intv);
h = (a + b)/N;
tk = a;
yk = y0;
teuler = a;
yeuler = y0;
ev = 0;
faux = @(t, y, f, h, z) [y + h*f(t, z)];
#+end_src
Put the cursor on the word «mismo» in the second line run the M-q and I obtain
#+begin_src
function [teuler,yeuler,ev]=mieulerimpfixpc(f,intv,y0,N,TOL,nmax) % se
implementa el tercer tipo de función dada por el
% enunciado
a = min(intv); % se preparan los datos de
% la mísma
forma como se ha comentado en la anterior
% función b
= max(intv); h = (a + b)/N; tk = a; yk =
% y0; teuler
= a; yeuler = y0; ev = 0; faux = @(t, y,
% f, h, z)
[y + h*f(t, z)]; for i = 1:N % la
% diferencia
fundamental con respecto a la función
% anterior
es que en este caso se va a utilizar para
% la
iteración simple como valor inicial 'y' el
% calculado
por el método de euler explícito t = tk +
% h; y_pred
= yk + h*f(tk, yk); % aquí se calcula
% dicha 'y'
que se va a utilizar en la iteración
% simple ev
= ev + 1; y = y_pred; k = 0; diff = 100;
% while diff
> TOL && k <= nmax % se hace la
% iteración
simple como en la anterior función pero
% teniendo
en cuenta ahora que la 'y' de valor
% inicial es
el calculado por el método de euler
% explícito
anteriormente obtenido k = k + 1; z =
% faux(t,
yk, f, h, y); diff = max(max(abs(z - y)));
% y = z; ev
= ev + 1; end
#+end_src
That is a disaster, code has changed into comments
--
I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel
I strongly condemn Putin's war of aggression against Ukraine.
I support to deliver weapons to Ukraine's military.
I support the EU and NATO membership of Ukraine.
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Matlab-emacs-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matlab-emacs-discuss
