contour map for stress distribution

19 views (last 30 days)
Cem Eren Aslan
Cem Eren Aslan on 31 May 2021
Commented: DGM on 31 May 2021
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

Answers (2)

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 31 May 2021
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 on 31 May 2021
Edited: DGM on 31 May 2021
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 Comments
Cem Eren Aslan
Cem Eren Aslan on 31 May 2021
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 on 31 May 2021
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:

Sign in to comment.

Categories

Find more on Contour Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!