How can I write a script to ask user to input any function which the script then calculates forward difference

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)

doc input
doc eval
Caution -- be careful; will evaluate whatever the user enters which may allow unintended consequences w/ a malevolent user...

2 Comments

Or inputdlg() for a more GUI-oriented, user-friendly approach.
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.

Sign in to comment.

Categories

Find more on Environment and Settings in Help Center and File Exchange

Products

Asked:

on 14 Sep 2013

Community Treasure Hunt

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

Start Hunting!