contour map for stress distribution
    조회 수: 4 (최근 30일)
  
       이전 댓글 표시
    
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 
댓글 수: 0
답변 (2개)
  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))
댓글 수: 0
  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
  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 Center 및 File Exchange에서 Contour Plots에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!