MATLAB: How to assign negative values to a variable

how to assign negative values to a variable

I am getting an error as like this.
Subscript indices must either be real positive integers or logicals.
my code is,
V = -60
am(V)=(0.01*(V+50))/(1-exp(-(V+50)/10))
but i need to pass V=-60 to am(V). how can i pass this.
Can anyone answer for this. Thanks in advance.

Best Answer

Your ‘am’ function needs to be coded as an anonymous function:
V = -60
am = @(V) (0.01*(V+50))/(1-exp(-(V+50)/10));
amV = am(V)
produces:
amV =
58.1977e-003