Plot along line y = x

8 vues (au cours des 30 derniers jours)
Mike
Mike le 3 Jan 2014
I have a function of 2 variables, x and y, and have been asked to plot it in 2D along the line y = x. I've checked the documentation for the plot command but couldn't find any relevant information.

Réponse acceptée

Walter Roberson
Walter Roberson le 3 Jan 2014
t = linspace(-3, 17, 500); %arbitrary bounds and number of points
plot3(t, t, f(t, t));
  2 commentaires
Image Analyst
Image Analyst le 3 Jan 2014
But won't you need to turn your "camera" or viewpoint so that you're looking at a 45 degree angle so that you're looking normal to the vertical y=x plane and not from some arbitrary point in space?
Walter Roberson
Walter Roberson le 3 Jan 2014
The problem statement doesn't require it. You can add a view() command if you want. Or you could work with the various Camera* axes properties; see http://www.mathworks.com/help/matlab/ref/axes_props.html#CameraPosition

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by