Values on a curve

조회 수: 5 (최근 30일)
Robert Wu
Robert Wu 2017년 1월 25일
편집: staticrain87 2017년 1월 26일
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.

답변 (1개)

staticrain87
staticrain87 2017년 1월 26일
편집: staticrain87 2017년 1월 26일
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!

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by