matlab - resample or interpolate a unevenly spaced path -


let's have path made of 3d points, distance between consecutive points not constant.

how resample such distance between consecutive points becomes constant?

i tried interp1 don't know original query points of hypotetically parametrized curve x(t),y(t),z(t).

example path:

enter image description here

you can use interparc matlab file exchange. in following example, function calculates 100 equally spaced points of original curve. default spline-interpolation used , gives smooth curve. defining optional parameter, can change behaviour. use 'linear' linear approximation (most efficient).

here code:

% define original points = [0.132488479262673 0.427113702623907;0.160138248847926 0.462099125364431;0.197004608294931 0.532069970845481;0.236175115207373 0.634110787172012;0.263824884792627 0.677842565597668;0.284562211981567 0.709912536443149;0.307603686635945 0.744897959183673;0.339861751152074 0.785714285714286;0.376728110599078 0.806122448979592;0.40668202764977 0.814868804664723;0.452764976958525 0.817784256559767;0.498847926267281 0.82069970845481;0.521889400921659 0.82069970845481;0.542626728110599 0.82069970845481;0.561059907834101 0.817784256559767;0.579493087557604 0.806122448979592;0.639400921658986 0.759475218658892;0.669354838709677 0.721574344023324;0.713133640552995 0.654518950437318;0.752304147465438 0.581632653061224;0.784562211981567 0.485422740524781;0.793778801843318 0.412536443148688;0.784562211981567 0.316326530612245;0.773041474654378 0.284256559766764;0.754608294930876 0.260932944606414;0.722350230414747 0.231778425655977;0.660138248847926 0.214285714285714;0.567972350230415 0.188046647230321];  % plot original figure plot(a(:,1),a(:,2),'*-')  % interpolate b = interparc(100,a(:,1),a(:,2));             % spline %b = interparc(100,a(:,1),a(:,2),'linear');   % linear  % plot interpolated figure plot(b(:,1),b(:,2),'*-') 

this result: result1_1 result1_2


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -