SlideShare a Scribd company logo
AML 702 Lab 8
                                                ODE-IVPs 1

Program-1
function yfinal=eulode(t0,tf,y0,h)
t(1)=t0;
y(1)=y0;
yexact = exp(-tf^2/2);
c = t0;
i = 0;
while(c<tf)
    i = i+1;
    dydt=-t(i)*y(i);
    y(i+1)=y(i) + dydt*h;
    t(i+1)=t(i)+h;
    c = c+h;
end
yfinal = y(i+1)
end
..........................................................................

function yf = error_eulode(t0,tf,y0,h)
yexact = exp(-tf^2/2);
n = length(h);
for i = 1:n
    yfinal = eulode(t0,tf,y0,h(i))
    err(i) = abs(yfinal - yexact)

end
plot(log(h),log(err),'-o');
hold on;
plot(log(h),log(h),'r');
xlabel('log(h)');
ylabel('log(err)');
end
...............................................................................................................................................................

>>i=0:1:14

i=

     0    1      2     3      4     5      6     7      8     9 10 11 12 13 14

>> h=2.^-i

h=

  1.0000 0.5000 0.2500 0.1250 0.0625 0.0313 0.0156 0.0078 0.0039 0.0020 0.0010
0.0005 0.0002 0.0001 0.0001

>> error_eulode(0,1,1,h)
yfinal =

  0.6065

err =

  0.3935 0.1435 0.0600 0.0275 0.0132 0.0065 0.0032 0.0016 0.0008 0.0004 0.0002
0.0001 0.0000 0.0000 0.0000

More Related Content

DOCX
Monte-carlo sim pricing EU call
DOCX
PYTHON. AM CALL Pricing Trees
PDF
Машинное обучение на JS. С чего начать и куда идти | Odessa Frontend Meetup #12
PDF
Ultrasonic with buzzer
DOCX
Python.St.Petersburg Paradox sim
DOCX
Cuarto Punto Parte A
DOCX
Segundo Punto
PDF
Complexity analysis
Monte-carlo sim pricing EU call
PYTHON. AM CALL Pricing Trees
Машинное обучение на JS. С чего начать и куда идти | Odessa Frontend Meetup #12
Ultrasonic with buzzer
Python.St.Petersburg Paradox sim
Cuarto Punto Parte A
Segundo Punto
Complexity analysis

What's hot (19)

DOCX
Tercer Punto
DOC
DOCX
Cuarto Punto Parte B
PDF
Learning to Sample
PDF
Multi risk factor model
TXT
Problemas de Arreglos en c++
DOCX
งาน 9
PPTX
Python for Scientists
DOC
VLSI experiments II
PDF
AugmentaP5 API
DOCX
Wap to implement bitwise operators
DOCX
Martha
DOCX
Quinto Punto Parte A
DOCX
Ejercicios Scilab Completo
PDF
Python profiling
PDF
Augmenta Contribution guide
DOCX
Trabajo Scilab
DOCX
งาน 9
Tercer Punto
Cuarto Punto Parte B
Learning to Sample
Multi risk factor model
Problemas de Arreglos en c++
งาน 9
Python for Scientists
VLSI experiments II
AugmentaP5 API
Wap to implement bitwise operators
Martha
Quinto Punto Parte A
Ejercicios Scilab Completo
Python profiling
Augmenta Contribution guide
Trabajo Scilab
งาน 9
Ad

Similar to Eulode (20)

DOCX
Lab 1 izz
PDF
Analysis and Matrix Multiplication using Parallel
PDF
ScilabTEC 2015 - J. Richalet
PPT
3. convolution fourier
PDF
型理論 なんて自分には関係ないと思っているあなたへ
PDF
Matlab plotting
DOCX
y Bookmarks People Window Helo Online Derivative edusubmi tionassig.docx
PPTX
LCD testtesttesttesttesttesttesttesttest
DOCX
PRACTICAL COMPUTING
PPT
Fourier Transform
DOCX
Operating system and embedded systems
PPT
PDF
CVD020 - Lecture Week 2
PDF
quantum chemistry on quantum computer handson by Q# (2019/8/4@MDR Hongo, Tokyo)
DOCX
Question 1. a) (i)(4+i2).(1+i3)4(1+i3)+i2(1+i3)4+i12+i2-6.docx
PDF
Dsp Lab Record
PPT
Continuous-Time Convolution in Linear Systems and Signals
PPT
Lecture 1
PDF
TensorFlow 2: New Era of Developing Deep Learning Models
PDF
Fourier transform
Lab 1 izz
Analysis and Matrix Multiplication using Parallel
ScilabTEC 2015 - J. Richalet
3. convolution fourier
型理論 なんて自分には関係ないと思っているあなたへ
Matlab plotting
y Bookmarks People Window Helo Online Derivative edusubmi tionassig.docx
LCD testtesttesttesttesttesttesttesttest
PRACTICAL COMPUTING
Fourier Transform
Operating system and embedded systems
CVD020 - Lecture Week 2
quantum chemistry on quantum computer handson by Q# (2019/8/4@MDR Hongo, Tokyo)
Question 1. a) (i)(4+i2).(1+i3)4(1+i3)+i2(1+i3)4+i12+i2-6.docx
Dsp Lab Record
Continuous-Time Convolution in Linear Systems and Signals
Lecture 1
TensorFlow 2: New Era of Developing Deep Learning Models
Fourier transform
Ad

Recently uploaded (20)

PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
cloud_computing_Infrastucture_as_cloud_p
PPTX
1. Introduction to Computer Programming.pptx
PDF
Encapsulation theory and applications.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
OMC Textile Division Presentation 2021.pptx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Getting Started with Data Integration: FME Form 101
NewMind AI Weekly Chronicles - August'25-Week II
Advanced methodologies resolving dimensionality complications for autism neur...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Univ-Connecticut-ChatGPT-Presentaion.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
SOPHOS-XG Firewall Administrator PPT.pptx
Encapsulation_ Review paper, used for researhc scholars
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
Programs and apps: productivity, graphics, security and other tools
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
cloud_computing_Infrastucture_as_cloud_p
1. Introduction to Computer Programming.pptx
Encapsulation theory and applications.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Spectral efficient network and resource selection model in 5G networks
Unlocking AI with Model Context Protocol (MCP)
OMC Textile Division Presentation 2021.pptx
Digital-Transformation-Roadmap-for-Companies.pptx
Getting Started with Data Integration: FME Form 101

Eulode

  • 1. AML 702 Lab 8 ODE-IVPs 1 Program-1 function yfinal=eulode(t0,tf,y0,h) t(1)=t0; y(1)=y0; yexact = exp(-tf^2/2); c = t0; i = 0; while(c<tf) i = i+1; dydt=-t(i)*y(i); y(i+1)=y(i) + dydt*h; t(i+1)=t(i)+h; c = c+h; end yfinal = y(i+1) end .......................................................................... function yf = error_eulode(t0,tf,y0,h) yexact = exp(-tf^2/2); n = length(h); for i = 1:n yfinal = eulode(t0,tf,y0,h(i)) err(i) = abs(yfinal - yexact) end plot(log(h),log(err),'-o'); hold on; plot(log(h),log(h),'r'); xlabel('log(h)'); ylabel('log(err)'); end ............................................................................................................................................................... >>i=0:1:14 i= 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 >> h=2.^-i h= 1.0000 0.5000 0.2500 0.1250 0.0625 0.0313 0.0156 0.0078 0.0039 0.0020 0.0010 0.0005 0.0002 0.0001 0.0001 >> error_eulode(0,1,1,h)
  • 2. yfinal = 0.6065 err = 0.3935 0.1435 0.0600 0.0275 0.0132 0.0065 0.0032 0.0016 0.0008 0.0004 0.0002 0.0001 0.0000 0.0000 0.0000