How to Create an Anonymous Function?

How do I enter ((-e^t) -1) / (1-e^t)) as an anonymous function?

Answers (1)

Stephan
Stephan on 18 Oct 2020
Edited: Stephan on 18 Oct 2020
Try to write it in one line - i guess you use an older release of Matlab, that does not support the semicolon operator in a second line - also a closing bracket ist missing:
x_explicit = @(t,x) ((-exp(t)-1)./(1-exp(t)));
btw: your function does not use x - why is it input argument?

2 Comments

Yea, it was the closing bracket; thankyou
Did you notice that you can accept and/or vote for useful answers?

This question is closed.

Asked:

on 18 Oct 2020

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!