contour map for stress distribution

조회 수: 12 (최근 30일)
Cem Eren Aslan
Cem Eren Aslan 2021년 5월 31일
댓글: DGM 2021년 5월 31일
I want to plot a contour map. It relates to stress distribution of a circular area. My trial as follows:
X =linspace(-4.5,4.5);
R=linspace(-4.5,4.5) ;
[X,Y] = meshgrid(X,Y);
Z= 3426.8/63.3+660*X*4/3.14/4.5^4+1700*sqrt(R^2-X^2)*4/3.14/4.5^4;
contourf(X,Y,Z)
Q1) How can i obtain continuous contour and its scale

답변 (2개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021년 5월 31일
HI,
Here is a corrected code:
X =linspace(-4.5,4.5);
R=linspace(-4.5,4.5) ;
[X,Y] = meshgrid(X,R);
Z= 3426.8/63.3+660*X*4/3.14/4.5^4+1700*sqrt(Y.^2-X.^2)*4/3.14/4.5^4;
contour3(X,Y,abs(Z))

DGM
DGM 2021년 5월 31일
편집: DGM 2021년 5월 31일
I don't know what you're doing, but this at least runs:
X = linspace(-4.5,4.5);
R = linspace(-4.5,4.5);
[X,Y] = meshgrid(X,R);
Z = 3426.8/63.3 + 660*X*4/3.14/4.5^4 + 1700*sqrt(Y.^2-X.^2)*4/3.14/4.5^4;
numlevels = 20; % set to whatever you want
contourf(X,Y,abs(Z),numlevels,'edgecolor','none')
I doubt that's what you want, but it's what I could guess from what you wrote. If you figure out what you're trying to plot, you can use contourf() with however many levels you want to get more Z-resolution. At some point though, it stops being useful as a contour map. Otherwise, you can just display Z using imagesc().
EDIT:
I decided to adopt Sulaymon's interpretation of intent. That makes a bit more sense.
  댓글 수: 2
Cem Eren Aslan
Cem Eren Aslan 2021년 5월 31일
Output is almost correct but the structure I analyzed is in the form of a circle but in the output graph it looks like a square.How can i fix it? How can i make it circle?
DGM
DGM 2021년 5월 31일
That still doesn't make sense. You have a plot that's R on one axis and X on the other. As far as your coordinate setup indicates, you have a sectional plot. Like I said. I doubt it's what you want, but it's what you wrote. I don't know how you want to make this into something else.
If you can represent your information in polar coordinates, you could do something like this:

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by