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
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