I want a program in which the user enters the function and the program display or plot that function

val=input("Enter Function",'s');
func= str2func( ['@(x) ' val ] );
x=(1:5);
y=func(x);
disp(y)
this is an example code that i wrote but code does not support x^2 and other amount of x^"any number"

More Answers (0)

Categories

Products

Release

R2023a

Asked:

on 10 May 2023

Commented:

on 10 May 2023

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!