필터 지우기
필터 지우기

Make a 2D Plot with 3 variables

조회 수: 81 (최근 30일)
Abinav
Abinav 2020년 9월 4일
댓글: KSSV 2020년 9월 4일
Hi,
I have an equation for a variable R that is dependent on two variables x and y. I solved the equation and have a list of values for R.
How do I plot R with respect to x and y. I can't find a way to specify x and y axis that correspond to the R values.
Thanks.
  댓글 수: 3
Abinav
Abinav 2020년 9월 4일
plot3() worked.
I was so silly.
Thanks.
Arthur Roué
Arthur Roué 2020년 9월 4일
If you want a 2D representation, you can use contour function.

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

답변 (1개)

KSSV
KSSV 2020년 9월 4일
Read about contour, countourf, pcolor.
[X,Y,Z] = peaks(100) ;
figure
pcolor(X,Y,Z) ; sjading interp ; colorbar
figure
contour(X,Y,Z)
figure
contourf(X,Y,Z)
% 3d representation
figure
surf(X,Y,Z)
If you don't want to use X, Y use only Z. It will be plotted w.r.t to indices.
[X,Y,Z] = peaks(100) ;
figure
pcolor(Z) ; sjading interp ; colorbar
figure
contour(Z)
figure
contourf(Z)
  댓글 수: 2
Abinav
Abinav 2020년 9월 4일
Hi,
Thanks for the suggestion. But plot3() is what I was expecting for. It worked.
KSSV
KSSV 2020년 9월 4일
Have a look on scatter, scatter3 you can plot with different colors and see the variations.

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

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by