Solving a simple integral with input equation from user
古いコメントを表示
I am using this code to enter an equation and solve a simple integral
str = input('Enter an equation in x: ','s') ;
f = function_handle.empty;
f = eval(['@()', str]);
x = f();
xmin= input('Lower limit of x: ')
xmax= input('Upper limit of x: ')
int(x, xmin, xmax)
But I get this error
Undefined function 'int' for input arguments of type 'double'.
Error in Untitled5 (line 7)
int(x,xmin, xmax)
採用された回答
その他の回答 (1 件)
Walter Roberson
2020 年 8 月 3 日
syms x
str = input('Enter an equation in x: ','s') ;
f = str2sym(str) ;
xmin= input('Lower limit of x: ')
xmax= input('Upper limit of x: ')
int(f,x, xmin, xmax)
カテゴリ
ヘルプ センター および File Exchange で Calculus についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!