Sine function in 2D

30 views (last 30 days)
Sucheta
Sucheta on 16 Dec 2022
Commented: Sucheta on 19 Dec 2022
I have already used the simple plot command but how can pcolor and contour plot be used to plot sine and cosine function in 2D? Need help!

Accepted Answer

KSSV
KSSV on 16 Dec 2022
x = linspace(0,2*pi) ;
y = x ;
[X,Y] = meshgrid(x,y) ;
Z = sin(X) ;
surf(X,Y,Z)
  1 Comment
Sucheta
Sucheta on 19 Dec 2022
Thank you! Could you also tell me how the light and lighting function can be used for the same?

Sign in to comment.

More Answers (0)

Categories

Find more on Contour Plots in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!