Matkab ,draw line in 3d

I need to draw a line in 3d using Matlab ,the reason for this is that I need to draw a model for
a line penetrating a surface ,for my students.

I just need to demonstrate to them how to find the angle between a line and a surface.
So how to do this using mesh() and meshgrid() ?

LVL 10
Who is Participating?
yuk99Connect With a Mentor Commented:
Use plot3 function:
If you need a line together with surface put 'hold on' before print3 statement and 'hold off' after that not to start a new figure.
Alternatively you can use line function with X,Y,Z vectors as parameters.
aboo_sAuthor Commented:
Thanks it worked!
All Courses

From novice to tech pro — start learning today.