Plot Stress Contours

I'm trying to plot stress contours for a project. Basically I have the coordinates Z (depth) and r (distance from tip) for ever stress field Sigma z and sigma r. I want to plot the contour lines of sigma z with respect to z in the y-axis and r in the x-axis. I've tried the contour command but it requires me to have matrices of 2x2 and I don't know why. If anyone can suggest a method to plot my data or help with the contour command I would really appreciate it.

답변 (1개)

Matt Tearle
Matt Tearle 2011년 6월 15일

0 개 추천

What are the dimensions of your variables? It sounds like maybe you have vector data? That is, Z, r, and sigma are all n-by-1. If so, you need to use something like TriScatteredInterp and meshgrid to put everything onto a grid (matrix). Then use contour.
See the documentation for TriScatteredInterp for an example of interpolating vector data onto a grid.
EDIT TO ADD (based on comment below): OK, in that case,
  1. make an interpolant from the data: F = TriScatteredInterp(r,Z,sigma);
  2. make a grid of z and r points: [rgrid,Zgrid] = meshgrid(linspace(min(r),max(r)),linspace(min(Z),max(Z)));
  3. evaluate the interpolant (1) on the grid (2): sigmagrid = F(rgrid,Zgrid);
  4. use the gridded data to make a plot: contour(rgrid,Zgrid,sigmagrid)

댓글 수: 1

Luis
Luis 2011년 6월 15일
Yea I think my data is coming out as a 1x21 matrix on each, I'll have to look into the TriScatteredInterp and meshgrid. Thank you for the advice.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터 및 File Exchange에서 Stress and Strain에 대해 자세히 알아보기

질문:

2011년 6월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by