HEJHEJ

mail@pastecode.io avatar
unknown
plain_text
2 years ago
338 B
2
Indexable
Never
hvec=1./2.^(1:8)';
u=@(x) cos(exp(x))
udiff_fram=(u(0.6+hvec)-u(0.6))./hvec;
udiff_central=(u(0.6+hvec)-u(0.6-hvec))/2./hvec;
udiff_skev=(-u(0.6+(2*hvec))+4*u(0.6+hvec)-3*u(0.6))/2./hvec;

du=@(x)-exp(x)*sin(exp(x));

fel_fram =abs(udiff_fram-du(0.6));
fel_central =abs(udiff_central-du(0.6));
fel_skev =abs(udiff_skev-du(0.6));