MATLAB Answers

Values on a curve

4 views (last 30 days)
Robert Wu
Robert Wu on 25 Jan 2017
Edited: staticrain87 on 26 Jan 2017
I have a long and flexible probe that is 19m in length. It collects a temperature readings every 0.50m and is stored in a vector (39 values). The probe is bent into a helix with a diameter of 0.70m and a depth of about 0.82m. I want to plot this helix in 2d (so a sine wave basically) with the associated temperature readings as the third dimension.
I then want to interpolate the area around the sine wave (so a 0.70m by 0.82m area) and create a colorplot with this interpolation. How should I start this? I'm pretty new to Matlab and I do not know how to associate a curve with values as a third dimension.

  0 Comments

Sign in to comment.

Answers (1)

staticrain87
staticrain87 on 26 Jan 2017
Edited: staticrain87 on 26 Jan 2017
I don't think that I am totally able to understand the crust of your question at this momenent. But what I can share quickly with you is how to do a contour plot z = f(x, y) in general
Let's say you have a vector x, y and z and x = [x1, x2.... xn]; y = [y1, y2, .... yn]; z=[z1, z2, .... zn]
%Now convert them into rectangular matrices using meshgrid, and grid data
xi=linspace(min(x),max(x), n); yi=linspace(min(y),max(y),n);
[XI YI]=meshgrid(xi,yi);
ZI = griddata(x,y,z,XI,YI);
contourf(XI,YI,ZI) %Finally do the contour plot
Hope it helps!

  0 Comments

Sign in to comment.

Sign in to answer this question.