Jul-25-2021, 06:33 PM
(This post was last modified: Jul-25-2021, 07:19 PM by Gribouillis.)
Hi,
For some time dependent biophysical model, I´m trying to visualize the certain
impulses occured on certain time. I define some step function below called as
>> The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
I do so, but then the results is not what I want. I just want to get the value 150.0 and 50. at specific
time range.
For some time dependent biophysical model, I´m trying to visualize the certain
impulses occured on certain time. I define some step function below called as
Id(.)
below. But, python complains about that. The message I receive is>> The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
I do so, but then the results is not what I want. I just want to get the value 150.0 and 50. at specific
time range.
# ............................... The Code ........................................# import matplotlib.pyplot as plt import numpy as np # Start and end time (in milliseconds) tmin = 0.0 tmax = 50.0 # Time values T = np.linspace(tmin, tmax, 5000) # Input stimulus def Id(t): if 0.0 < t < 1.0: return 150.0 elif 10.0 < t < 11.0: return 50.0 return 0.0 # Input stimulus Idv = Id(T) #Idv = [Id(t) for t in T] fig, ax = plt.subplots(figsize=(12, 7)) ax.plot(T, Idv) ax.set_xlabel('Time (ms)') ax.set_ylabel(r'Current density (uA/$cm^2$)') ax.set_title('Stimulus (Current density)') plt.grid() # .................................................................................................#
Gribouillis write Jul-25-2021, 07:19 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
I fixed for you this time. Please use code tags on future posts.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
I fixed for you this time. Please use code tags on future posts.