"Saptarshi Bhattacharjee" wrote in message <jdrh75$md9$1@newscl01ah.mathworks.com>...
> I have a problem where I am given a function f(x) where I need to plot the curve between f(x) and x. The problem I am facing is with dealing with the multiple outputs of f(x) for each x. Range of x is [0,4]. Can anyone help me with this??
         
Could you please be more explicit about the statement "I am given a function"? In what form is the function given to you that would enable it to be multivalued?
As an example of what you might be facing, suppose you are given the implicit equation:
(x2)^2 + y^2 = 4
As we all know, this is the equation of a circle with center at (2,0) and radius 2, but if we try to express y as a function of x, we find that there are actually two functions:
y = sqrt(x*(4x))
and
y = sqrt(x*(4x))
You can either use both functions in creating a plot in two separate pieces, the upper half circle and the lower one, or else you can seek some parameter that will generate the entire curve. This latter parametric approach would look like this:
a = linspace(0,2*pi); % Arc angles to points around the circle
x = 2+2*cos(a); % x coordinates of those points
y = 2*sin(a); % y coordinates of those points
plot(x,y) % Plot y against x
Roger Stafford
