I have a contour plot. I need to shrink it about its origin. I have tried to shrink it as a polygon but it does not work. Could you please help me to overcome the problem? I want shrinking the contour plot about its origin.
I found the code below, but it is for contour plot rotation.
Note: I use matlab ver. 2008.
Any help will be much appreciated.
a = 37;
[x,y] = meshgrid(linspace(-4,4,30));
z = exp(-x.^2/15-y.^2);
contour(x,y,z)
xlim([-5 5])
ylim([-5 5])
axis equal
figure
[C,h] = contour(x,y,z);
rotate(get(h,'children'),[0 0 1],a)
xlim([-5 5])
ylim([-5 5])
axis equal
Many thanks
Israa

댓글 수: 2

Ameer Hamza
Ameer Hamza 2020년 10월 10일
Can you explain what do you mean by shrinking the plot?
israa abdul jabbar
israa abdul jabbar 2020년 10월 10일
편집: israa abdul jabbar 2020년 10월 10일
i want to make 2D transformation(scaling ) for the resulting contour plot. I want to reduce( shrink) the size of final contour plot about its origin .

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

답변 (2개)

KSSV
KSSV 2020년 10월 10일

0 개 추천

You change the x,y limits and use the same z...
a = 37;
[x,y] = meshgrid(linspace(-4,4,30));
z = exp(-x.^2/15-y.^2);
figure(1)
contour(x,y,z)
xlim([-5 5])
ylim([-5 5])
axis equal
[x1,y1] = meshgrid(linspace(-1,1,30));
figure(2)
contour(x1,y1,z)
xlim([-1 1])
ylim([-1 1])
axis equal

댓글 수: 7

Thank you so much, but i want to make 2D transformation(scaling ) for the resulting contour plot. I want to reduce( shrink) the size of final contour plot about its origin .
KSSV
KSSV 2020년 10월 10일
Yes this can be done....read about Afine transformations. In there you have a transformation matrix to reduce the scale of your polygons.
i did but it failed because contour polt or contour matrix is not a polygon. Thank you so much
KSSV
KSSV 2020년 10월 10일
You have the points in hand...that's enough ..
Below, my code for scaling contour plot, but it failed
center=polygonCentroid(u); % u is my contour plot
scalmatrix=createScaling(center,0.25,0.25); % making scaling matrix
u=transformPoint(u,scalmatrix); % scaling or shrinking process
[c,h] = contour(u,[2 2],'y','linewidth',3);
What are these functions:
polygonCentroid
createScaling
transformPoint
and where did you get them?
I can find no references for them either in the MATLAB online documentation or in an Interweb search.
You are doing KSSV a definite disservice by not revealing sources for them or posting the code for them.
iI take these functions from library called "geom2d", i got it from site of mathworks(file exchange). I added that library to my matlab(2008). my code is acceptable and implemented, but the results were wrong.
Note:
geom2d
version 1.25 (427 KB) by David Legland
Geometry library for matlab. Performs geometric computations on points, lines, circles, polygons...

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

israa abdul jabbar
israa abdul jabbar 2020년 10월 10일

0 개 추천

i want to make 2D transformation(scaling ) for the resulting contour plot. I want to reduce( shrink) the size of final contour plot about its origin .

카테고리

도움말 센터 및 File Exchange에서 Contour Plots에 대해 자세히 알아보기

제품

릴리스

R2008a

질문:

2020년 10월 10일

댓글:

2020년 10월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by