0

I have function which takes 2 inputs:

function [r] = myfunc(x,y)

I want to plot this function but i get this error:

>> plot(myfunc, [1 2]);
Error using myfunc (line 2)
Not enough input arguments.
1
  • That's because you're not calling plot properly. plot takes in a set of x values and a set of y values as the default set of parameters. The output will produce a figure that plots points. Can you show what myfunc looks like? Depending on what it looks like, I can suggest options to help you plot your function. Commented May 29, 2014 at 23:56

2 Answers 2

1

If I understand your question, I think you're looking for this:

[r] = myfunc(x,y)
plot(x, y, r)

I'm assuming that myfunc takes x and y as vectors, and returns r as a vector. If not, let me know, and I'll post an edit explaining how to properly set up x, y, and z for use with plot.

Sign up to request clarification or add additional context in comments.

1 Comment

This should possibly use plot3 if it's a 3D curve. That code will plot (x, y) values with r as additional properties to the curve... Colour... Markers.
1

when you have 3 variables (i.e. x,y and r) you cannot use 2D plot and you should use plot3(x,y,myfunc(x,y)) instead.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.