I want a program in which the user enters the function and the program display or plot that function
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
amir
am 10 Mai 2023
Kommentiert: amir
am 10 Mai 2023
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"
0 Kommentare
Akzeptierte Antwort
Antoni Garcia-Herreros
am 10 Mai 2023
Bearbeitet: Antoni Garcia-Herreros
am 10 Mai 2023
Hello Amir,
When you input your function you need to add the dot , just like this: x.^n
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Thermal Analysis finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!