From: Shawn on 12 Mar 2010 14:21 After meshing with DelaunayTri, a few duplicate points are removed, however when I then get TriscatteredInterp the Data array no longer matches up with the XY values, and it fails. I'm sure I got around this before, but coming back to it now I haven't the foggiest idea how, suggestions? If its simplest I can try to figure out where those duplicate points are and deal with it prior to delaunaytri, or is there a way to match up the triangulation with the dataset afterwards?
From: Sujeet Phanse on 12 Mar 2010 16:00 You can call TriScatteredInterp directly with your X and V, no need to first create a DelaunayTri. This way your points and values will automatically remain "in-sync". Bear in mind though that values at any duplicate points in X will be averaged before the interpolation is carried out, e.g. X=rand(4,2); XwithDups = [X;X]; V = [100*ones(4,1);zeros(4,1)]; F=TriScatteredInterp(XwithDups,V); % notice that duplicate points have been removed % and values have been averaged so that it is 50 F1.V % now interpolate at (0.75,5) F1(0.75,0.5) If averaging of the values is not the behavior you need or if it isn't appropriate for your use case, then you will have to identify the duplicate locations and treat the values appropriately yourself. "Shawn " <sfostner(a)physics.mcgill.ca> wrote in message news:hne47g$6t$1(a)fred.mathworks.com... > After meshing with DelaunayTri, a few duplicate points are removed, > however when I then get TriscatteredInterp the Data array no longer > matches up with the XY values, and it fails. I'm sure I got around this > before, but coming back to it now I haven't the foggiest idea how, > suggestions? > If its simplest I can try to figure out where those duplicate points are > and deal with it prior to delaunaytri, or is there a way to match up the > triangulation with the dataset afterwards?
From: Sujeet Phanse on 12 Mar 2010 16:08 Last two code lines in the example below should have been: F.V F(0.75,0.5) "Sujeet Phanse" <sphanse(a)mathworks.com> wrote in message news:hnea19$jtk$1(a)fred.mathworks.com... > You can call TriScatteredInterp directly with your X and V, no need to > first create a DelaunayTri. This way your points and values will > automatically remain "in-sync". Bear in mind though that values at any > duplicate points in X will be averaged before the interpolation is carried > out, e.g. > > X=rand(4,2); > XwithDups = [X;X]; > V = [100*ones(4,1);zeros(4,1)]; > F=TriScatteredInterp(XwithDups,V); > % notice that duplicate points have been removed > % and values have been averaged so that it is 50 > F1.V > % now interpolate at (0.75,5) > F1(0.75,0.5) > > If averaging of the values is not the behavior you need or if it isn't > appropriate for your use case, then you will have to identify the > duplicate locations and treat the values appropriately yourself. > > > > "Shawn " <sfostner(a)physics.mcgill.ca> wrote in message > news:hne47g$6t$1(a)fred.mathworks.com... >> After meshing with DelaunayTri, a few duplicate points are removed, >> however when I then get TriscatteredInterp the Data array no longer >> matches up with the XY values, and it fails. I'm sure I got around this >> before, but coming back to it now I haven't the foggiest idea how, >> suggestions? >> If its simplest I can try to figure out where those duplicate points are >> and deal with it prior to delaunaytri, or is there a way to match up the >> triangulation with the dataset afterwards? > > >
|
Pages: 1 Prev: struct element as function input Next: color image watermarking |