Prev: blood simscape
Next: neural network outputs
From: Nadine Cooper on 18 Apr 2010 09:03 Hi all, I'm working a project that will map (contour) pressure points on a cushion. I've got 8 sensors placed to map pressure points under specific parts of the body. Here's what it looks like: x and y correlate to the dimensions of the cushion and where sensors are placed x = [50 67 110 140 162 190 235 262]' y = [81 209 135 78 78 135 209 81]' plot(x,y,'.') The 'dots' show the sensor positions on the cushion What I'm trying to do is create a contour map to show elevations in pressure at EACH point marked above The following z values denote the binary readings from the sensors z = [254 41 249 80 83 230 40 210]' Here's what I'm doing at the moment: tri = delaunay(x,y) trisurf(tri,x,y,z) rangeY = min(y):5:max(y); rangeX = min(x):5:max(x); [X,Y] = meshgrid(rangeX,rangeY); Z = griddata(x,y,z,X,Y,'cubic') surf(X,Y,Z) rangeZ = min(z):5:max(z); contour(X,Y,Z,rangeZ) However, this isn't exactly what I want, and I'm sure it's due to my lack of calculations. I want a peak (or trough) for every sensor position, and what I'm getting so far is just an overall view of where pressure is high (255) and where it's low (10) I'm almost certain it's to due with interpolation - it doesn't seem that I'm doing enough, though I'm unclear exactly how to work it out. I've gone through the help files over and over again but to be honest, I can't make sense of the information in relation to my data, if that makes sense. I'm hoping someone out there is able to point me in the right direction!! Many, many thanks for taking the time to read this - Nadine
From: Rune Allnor on 18 Apr 2010 09:35 On 18 apr, 15:03, "Nadine Cooper" <nadine.beas...(a)hotmail.co.uk> wrote: > Hi all, > > I'm working a project that will map (contour) pressure points on a cushion. > > I've got 8 sensors placed to map pressure points under specific parts of the body. You can't use CONTOUR for irregular points. As far as I know, matlab has no function to contour scattered points (such function might have been introduced recently, though), but I do know that there are functions on the FEX for this kind of thing. Search among John D'Errico's contributions on the FEX. Rune
From: John D'Errico on 18 Apr 2010 09:44 "Nadine Cooper" <nadine.beasley(a)hotmail.co.uk> wrote in message <hqevu9$29q$1(a)fred.mathworks.com>... > Hi all, > > I'm working a project that will map (contour) pressure points on a cushion. > > I've got 8 sensors placed to map pressure points under specific parts of the body. > > Here's what it looks like: x and y correlate to the dimensions of the cushion and where sensors are placed > > x = [50 67 110 140 162 190 235 262]' > y = [81 209 135 78 78 135 209 81]' > plot(x,y,'.') > > The 'dots' show the sensor positions on the cushion > > What I'm trying to do is create a contour map to show elevations in pressure at EACH point marked above > > The following z values denote the binary readings from the sensors > > z = [254 41 249 80 83 230 40 210]' > > > Here's what I'm doing at the moment: > > tri = delaunay(x,y) > trisurf(tri,x,y,z) > rangeY = min(y):5:max(y); > rangeX = min(x):5:max(x); > [X,Y] = meshgrid(rangeX,rangeY); > Z = griddata(x,y,z,X,Y,'cubic') > surf(X,Y,Z) > > rangeZ = min(z):5:max(z); > contour(X,Y,Z,rangeZ) > > However, this isn't exactly what I want, and I'm sure it's due to my lack of calculations. I want a peak (or trough) for every sensor position, and what I'm getting so far is just an overall view of where pressure is high (255) and where it's low (10) > > I'm almost certain it's to due with interpolation - it doesn't seem that I'm doing enough, though I'm unclear exactly how to work it out. > > I've gone through the help files over and over again but to be honest, I can't make sense of the information in relation to my data, if that makes sense. > > I'm hoping someone out there is able to point me in the right direction!! > > Many, many thanks for taking the time to read this - You did well to get the surface using trisurf, and also to use griddata properly. (There is also trimesh.) A problem is that if you FIRST interpolate the surface from your data using griddata, then try to build a contour plot, you are contouring an approximation to your data. I think that is the problem you have alluded to. One thing that is lacking in matlab is a tricontour function that will apply directly to triangulated data. A tool for this is available on the File Exchange though. http://www.mathworks.com/matlabcentral/fileexchange/10408 I think this may help you. John
From: John D'Errico on 18 Apr 2010 09:50 Rune Allnor <allnor(a)tele.ntnu.no> wrote in message <66262580-4f21-42b0-b8ad-4e2774616da8(a)b33g2000yqc.googlegroups.com>... > On 18 apr, 15:03, "Nadine Cooper" <nadine.beas...(a)hotmail.co.uk> > wrote: > > Hi all, > > > > I'm working a project that will map (contour) pressure points on a cushion. > > > > I've got 8 sensors placed to map pressure points under specific parts of the body. > > You can't use CONTOUR for irregular points. As far as I know, > matlab has no function to contour scattered points (such function > might have been introduced recently, though), but I do know that > there are functions on the FEX for this kind of thing. > > Search among John D'Errico's contributions on the FEX. (Actually, I DID write a tricontour function some time ago, but Darren wrote/posted a better version than I had, before I had time to post mine anyway.) John
From: Nadine Cooper on 18 Apr 2010 10:30
"John D'Errico" <woodchips(a)rochester.rr.com> wrote in message <hqf2me$duq$1(a)fred.mathworks.com>... > Rune Allnor <allnor(a)tele.ntnu.no> wrote in message <66262580-4f21-42b0-b8ad-4e2774616da8(a)b33g2000yqc.googlegroups.com>... > > Search among John D'Errico's contributions on the FEX. > > (Actually, I DID write a tricontour function some time > ago, but Darren wrote/posted a better version than I > had, before I had time to post mine anyway.) > > John Hi John, I did search through your contributions on the file exchange, and found your gridfit demo; I've started to play around with that though I'll now try out the tricontour files as well. Which do you reckon is more suitable? I thought gridfit did pretty much what I need - fits a surface to a scatter plot (which is inherently the data type I've got) Though I could be wrong! Forgive me, I'm very new to Matlab and there's just so much information being thrown around! However, I thank you sincerely for replying and helping me out :) |