In Mathematica, how to make Interpolation as good as ListLinePlot? -


first, learned in mathematica, interpolation function listplot using? the method used listplot interpolation interpolate each coordinate function of list index. , think listlineplot can decide interpolationorder should taken. if change interpolationorder -> 3 interpolationorder -> 1 , intepolation of data more plot of listlineplot. here data , code:

so, there way can interpolate data , plot listlineplot do? or there way make interpolation more "clever", can decide interpolationorder itself? here data , code:

mypoint = {{1.3336020610508064`,  0.05630827677109675`}, {1.5103543939292194`,  0.05790550283922009`}, {1.6927497417380886`,  0.07151008153610137`}, {1.840047310044461`,  0.11741226450605104`}, {1.9209270855795286`,  0.2726755425789721`}, {1.953407919235778`,  2.0759615023390294`}, {1.9550995254889463`, 0.7164793699550908`}}; interpcut[r_, x_] := module[{s}, s = sortby[r, first]; piecewise[{{0, x < first[s][[1]]}, {0,   x > last[s][[1]]}, {interpolation[r, interpolationorder -> 3][x],   true}}]]; interpolation1[x_] := interpcut[mypoint, x]; listplot[mypoint, plotstyle -> orange] listlineplot[mypoint, plotstyle -> orange] plot[interpolation1[x], {x, 1.3, 2}, plotrange -> all,   plotstyle -> orange] 

thanks, jzm

for question of @agentp:

mypoint1 = {{1.3336020610508064`,  0.05630827677109675`}, {1.5103543939292194`,  0.05790550283922009`}, {1.6927497417380886`,  0.07151008153610137`}, {1.840047310044461`,  0.11741226450605104`}, {1.9209270855795286`,  0.2726755425789721`}, {1.953407919235778`,  2.0759615023390294`}, {1.9550995254889463`, 0.7164793699550908`}}; interpcut[r_, x_] := module[{s},(*sort array x coord*)s = sortby[r, first]; piecewise[{{0, x < first[s][[1]] + 0.002}, {0,   x > last[s][[1]] - 0.002}, {interpolation[r][x], true}}]]; group1point = listplot[mypoint1, plotstyle -> red]; group1interpolation[x_] := interpcut[mypoint1, x]; group1line = plot[group1interpolation[x], {x, 1.3, 2}, plotrange -> all, plotstyle -> red]; show[{group1point, group1line}, frame -> true, imagesize -> 500] 


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -