Hi,(adsbygoogle = window.adsbygoogle || []).push({});

My question is in relation to Matlab.

I'm curious, is there anyway to employ user inputs for function handles?

By this I mean that the user is prompted to enter they're chosen function and the next line of code employs that into a handle.

My quick and rough attempt was:

a=input('enter a function in terms of x: ')

f=@(x) a

But I receive an error saying "Undefined function or variable x"

Any suggestions greatly appreciated.

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# [Matlab] Function Handle-user input

Tags:

Loading...

Similar Threads - Matlab Function Handle | Date |
---|---|

Working with Edge function in MATLAB | Mar 7, 2017 |

Matlab Does MatLab have this kind of function? | Jan 15, 2017 |

Matlab error matrix function | Apr 25, 2016 |

Matlab : Function handle givin array to cell array of function handles | Mar 5, 2014 |

MATLAB: cell arrays of function handles | Apr 23, 2010 |

**Physics Forums - The Fusion of Science and Community**