How can I write a script to ask user to input any function which the script then calculates forward difference
Show older comments
What input command allows the script to ask the user to enter any function, polynomial, log, trigonometry or any combination and then the script can use this function to perform calculations?
Answers (1)
dpb
on 14 Sep 2013
doc input
doc eval
Caution -- be careful; will evaluate whatever the user enters which may allow unintended consequences w/ a malevolent user...
2 Comments
Image Analyst
on 14 Sep 2013
Or inputdlg() for a more GUI-oriented, user-friendly approach.
dpb
on 14 Sep 2013
Indeed, on the UI but the same caveats of watching what one chooses to evaluate hold true...safer is to have a library of functional forms that user can select from and then define coefficients as needed. listdlg would be a good candidate for at least one alternative such an approach.
Categories
Find more on Environment and Settings in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!