Reputation: 3406
I have 3 functions f1=f1(x), f2=f2(x) and f3=f3(x). I can plot three 2d graphs on a single figure with the command hold on
, but I would like to plot three graphs in a single 3d graph.
I can plot a 3d surface with surf
command.
x = -3:0.1:3;
y = [1,2,3];
z = [f1(x);f2(x);f3(x)];
surf(x,y,z)
Since the y variable does not lay in a range, but has discrete values, this graph does not make sense.
It would be better a 3d graph like the previous one for the x variable and something like a bar chart for the y variable. Is it possible to plot a "mixed" graph like that?
To better explain what I would like to obtain, I add this graph found with the help of Google
Upvotes: 2
Views: 3222
Reputation: 112679
The ribbon
function does what you want, except that it only shows the top part:
>> ribbon(peaks(15)) %// using the `peaks` function as an example
Upvotes: 4