Harj. 7 teht. 4 =============== t=linspace(-1,3); y=exp(-al*(t-1).^2)'; yparvi=[-2*y -1*y 0*y 1*y 2*y 3*y -3*y]; plot(t,yparvi) grid help Euler [T,Y] = euler(f,a,b,ya,m) Euler's solution for y' = f(t,y) with y(a) = ya. f is the function, input. a is the left endpoint, input. b is the right endpoint, input. ya is the initial condition, input. m is the number of steps, input. T is the vector of abscissas, output. Y is the vector of ordinates, output. figure [T,Y]=euler('ft4',0,4.5,1,10); plot(T,Y) [T,Y]=euler('ft4',1,4.5,1,30);plot(T,Y) [T,Y]=euler('ft4',1,4.5,1,20);plot(T,Y) % tassa valissa se tapahtuu (siis 20 < m < 30) Lasketaan df/dy=-2alpha(t-1) ja katsotaan tehtäväpaperissa olevaa, luennolla johdettua askelpituusehtoa. Siis kun t>1, tehtävä on stabiili ja silloin Euler on stabiili, jos h < 2/|df/dy|. Katsotaan keskimääräinen arvo tarkasteltavalla välillä ja todetaan Euler-ratkaisun holtiton heilahtelu, kun askelpituus on liian suuri. Tässä on siis tyypillinen epästabiilisuuskäytös.