Matlab Help: EZplot for x^2 – 6x – 12

  • MATLAB
  • Thread starter mech-eng
  • Start date
  • Tags
    Matlab
In summary, the problem is that the input provided is neither a function handle nor a string, which is required for the ezplot function to work properly.
  • #1
mech-eng
828
13
d = x^2 –6*x – 12;

>> ezplot(d)
Error using inlineeval (line 15)
Error in inline expression ==> x.^2 –6.*x – 12
Error: The input character is not valid in MATLAB statements or
expressions.

Error in inline/feval (line 34)
INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr,
INLINE_OBJ_.expr);

Error in ezplotfeval (line 52)
z = feval(f,x(1));

Error in ezplot>ezplot1 (line 469)
[y, f, loopflag] = ezplotfeval(f, x);

Error in ezplot (line 145)
[hp, cax] = ezplot1(cax, f{1}, vars, labels, args{:});


what is the problem here?
 
Physics news on Phys.org
  • #2
From the doc:

"ezplot(fun) plots the expression fun(x) over the default domain -2π < x < 2π, where fun(x) is an explicit function of only x.

fun can be a function handle or a string."

What you input is neither a function handle:

d = @(x) x.^2 - 6.*x -12;
ezplot(d)nor a string:

d = 'x^2 - 6*x-12';
ezplot(d)

http://www.mathworks.com/help/matlab/ref/ezplot.html
 

What is the purpose of EZplot for x^2 – 6x – 12 in Matlab?

EZplot is a function in Matlab that allows for easy plotting of mathematical equations. In this case, the equation x^2 – 6x – 12 will be graphed on a 2-dimensional plot.

How do I use EZplot for x^2 – 6x – 12 in Matlab?

To use EZplot, you first need to define the equation you want to plot as a function in Matlab. Then, you can call the EZplot function and input the equation as the argument. The resulting graph will be displayed in the current figure window.

What is the input and output format for EZplot for x^2 – 6x – 12 in Matlab?

The input for EZplot is the mathematical equation in the form of a function, while the output is a 2-dimensional plot of that equation. The plot will have a default range of x values, but this can be adjusted using additional arguments in the EZplot function.

Can I customize the plot generated by EZplot for x^2 – 6x – 12 in Matlab?

Yes, you can customize the plot by using additional arguments in the EZplot function. These arguments can adjust the range of x values, add a title and axis labels, change the line color and style, and more. You can also use standard Matlab plot functions to further customize the plot.

Is EZplot for x^2 – 6x – 12 in Matlab suitable for all types of equations?

EZplot is suitable for most common mathematical equations, including polynomials, trigonometric functions, and exponential functions. However, it may not work for more complex equations or equations with multiple variables. In those cases, it may be necessary to use other plotting functions in Matlab.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
13K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
9K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
5K
  • Precalculus Mathematics Homework Help
Replies
7
Views
759
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
27K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
16K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
6K
Back
Top