Jan-07-2019, 03:25 AM
Hi,
I am new to python. I am translating matlab code into python. I am stuck when I want to do the for loop statement as shown
in the last paragraph below. Can anyone help on this? Thank you.
I am new to python. I am translating matlab code into python. I am stuck when I want to do the for loop statement as shown
in the last paragraph below. Can anyone help on this? Thank you.
nMonth = Fcst.shape[0] nProduct = Fcst.shape[1] nScenario = 1000 FlexCostPremium = 0.14 # Generate Demand Scenarios import numpy as np Fcst_nScenario =np.kron(np.ones((nScenario,1)),Fcst) Bias_nScenario =np.kron(np.ones((nScenario,1)),Bias) Sigma_nScenario =np.kron(np.ones((nScenario,1)),Sigma) Error = np.zeros((Fcst_nScenario.shape)) for i in range (nProduct): for j in range (nMonth*nScenario): Error(j,i)=np.random.standard_normal((Bias_nScenario(j,i),Sigma_nScenario(j,i))) end end