determining order of accuracy

64 views (last 30 days)
Ethan Boyce
Ethan Boyce on 27 Jan 2020
Answered: J. Alex Lee on 27 Jan 2020
I've been given a table of discretion size and relative error and asked to determine the order of accuracy. I am new to Matlab and I am unsure how to tell matlab how to calculate this
h = 0.2 0.1 0.05 0.025
e = 6.98e-8 1.4e-9 2.5e-11 4.2e-13

Accepted Answer

J. Alex Lee
J. Alex Lee on 27 Jan 2020
This is not a matlab question but a numerical analysis problem. Since someone already generated the results for you, it's a matter of understanding that typical discretization errors scale with the discretization size raised to some power, which is the order of accuracy
where h is the discretization size, so
So within a shift, you can find the order of accuracy p
h = [0.2 0.1 0.05 0.025 ]
e = [6.98e-8 1.4e-9 2.5e-11 4.2e-13]
pfit = polyfit(log(h),log(e),1)
p = pfit(1)

More Answers (0)

Categories

Find more on Tables in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!