How can i 3d plot z=x*y

13 views (last 30 days)
Gabriel Salazar
Gabriel Salazar on 7 Dec 2017
Answered: Star Strider on 7 Dec 2017
I tried this but didn't work [x,y]=meshgrid(-5:5) z=x*y Plot3(x,y,z)

Accepted Answer

Star Strider
Star Strider on 7 Dec 2017
Try this:
z = x .* y;
You need to do ‘element-wise’ multiplication, and adding the ‘dot operator’, changing (*) to (.*). will do this.
See the documentation on Array vs. Matrix Operations (link) for details.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!