working with random variable

2 次查看(过去 30 天)
Dear All, I am working with random variable. consider D (distance of points) is a Given Number. when I use only one number for example D=60 my script is working. However. when using more than one in my case 362 points (attached). the script is error. I am new in matlab. Thank you very much for assistance.
WTC= 2.5;
n=1000;
D=60;
r=0.1;
% Development and Consenting (DC)
DC = 100823310 + (173435860-100823310).*rand(n,1);
DCcost=DC*WTC;
%Construction Phase insurance (CPI)
CPI=59850+(73150-59850).*rand(n,1);
CPIcost=CPI*WTC;
%Turbine Cost (TC)
TC= 8401610 + (9753630-8401610).*rand(n,1);
TCcost=TC*WTC;
%Substructure Cost Monopile
SCMcost= 1915200+(4468800-1915200).*rand(n,1);
%Electric Infrastructure (EI)
EI = 4948*D+279580;
%Installation Cost Monopile (ICM)
ICMcost=1587488+(2381232-1587488).*rand(n,1);
% Electric infrastructure Installation
EII=535060+(557760-535060).*rand(n,1);
EIIcost=EII*WTC;
CAPEX = DCcost+CPIcost+TCcost+SCMcost+EI+ICMcost+EIIcost;
%OPEX
OM=13041*D+5e7;
%Operating phase insurance (OPI)
OPI=18360+(27540-18360).*rand(n,1);
OPIcost=OPI*WTC;
OPEX=OM+OPIcost;
t = 15 + (25-15).*rand(n,1);
cf = 0.072+(60.8-0.072 ).*rand(n,1);
crf=(r*(1+r).^t)./((1+r).^t-1);
annual=cf*8760;
LCOE=(CAPEX.*crf+OPEX)./annual;

采纳的回答

Walter Roberson
Walter Roberson 2019-2-2
I suspect you need to change to something like,
WTC= 2.5;
load D.mat
D = Lm; %the stored variable name is Lm ??
n = size(D,1);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Mathematics 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by