I have a "tension" vector with about 30 values inside, to generate a new vector "defo_calculada2" I need to add 0.2 in each value of the "tension" vector, I believe you have a correct way to do this sum in vector < p>
defo_calculada2 = tension + 0.2
I have a "tension" vector with about 30 values inside, to generate a new vector "defo_calculada2" I need to add 0.2 in each value of the "tension" vector, I believe you have a correct way to do this sum in vector < p>
defo_calculada2 = tension + 0.2
The simplest way is to use list comprehension to generate the new list:
tensao = [1, 2, 3, 4, 5]
defo_calculada2 = [t + 0.2 for t in tensao]
print(defo_calculada2) # [1.2, 2.2, 3.2, 4.2, 5.2]
If you use the NumPy library, simply add it to the array :
import numpy as np
tensao = np.array([1, 2, 3, 4, 5])
defo_calculada2 = tensao + 0.2
print(defo_calculada2) # [1.2 2.2 3.2 4.2 5.2]