help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Making a 3D graph with highlighted area


From: Alice Ander
Subject: Making a 3D graph with highlighted area
Date: Thu, 24 Apr 2014 00:18:20 -0700

I’m trying to make a 3D graph of y=1+x^3, highlighting the
area under the function curve where x is between 1 and 2.
 
Is this possible?
 
This is a 2D graph I created in octave with a highlighted area:
image[2]
 
This are the my octave commands:
# assign values to vector x from -5 to 5 step by .1
x=-5:0.1:5;
# calculate values of y
y=1.+x.^3;
#make 2d plot
plot(x,y);
# put formula in the graph title
title('y=1+x^3');
#redefine lo and hi points on the plot
axis([-10 10 -10 10 0 1]);
### draw the filler space under the graph
# keep old graph in place while drawing new graph
hold on;
# define fill area of x from 1 to 2
x=1:0.1:2;
#recalc given new x values
y=1.+x.^3;
# fill the selected area
area(x,y);
grid();
 
My problem -- I have not been able to make the 2D graph into a 3D graph.
 
This is a graph I made in 3D Grapher without the highlighted area. 
I would like to make a similar graph in octave, if possible, including
a highlighted area under the graph where x is between 1 and 2.
 
image[8]
 
Is this possible?  Also, if this is really involved just let me know and
I’ll come back to it after I’ve got more octave experience.  Of course I’m hoping
this might not be too involved.

Thank you for any help you might be able to give.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]