Taking expression input and plotting it within an interval using app designer
Show older comments
I need to take a single variable expression as input from the user and give the plot for the same. I am able to take the expression input and make it a function using inline, but when I go for plotting it within an interval it shows the following error:
Error using inlineeval (line 14)
Error in inline expression ==> x^2 - 11*x + 30
Incorrect dimensions for raising a matrix to a power. Check that the matrix is square and the power is a scalar. To perform elementwise matrix powers, use '.^'.
Error in inline/subsref (line 23)
INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr);
My code for input was:
s = app.EnterHereEditField.Value;
f = inline(s);
and for plotting:
x = -10:.1:10;
y = f(x);
plot(app.UIAxes,x,y);
I am new to matlab app designer, if there's some syntax error please tell. Thanks!
Accepted Answer
More Answers (0)
Categories
Find more on Mathematics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!