determining order of accuracy

70 次查看(过去 30 天)
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

采纳的回答

J. Alex Lee
J. Alex Lee 2020-1-27
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)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Tables 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by