How to store answers from function in array?
2 次查看(过去 30 天)
显示 更早的评论
Hey guys. I have some data for each hour in a year, where each hour has a different function. Each function, each hour, calculates T_opt. How can i store each answer that i get in one array, instead of separate answers? Hope you get what trying to explain :)
a_dk = zeros(8761,1);
a_be = zeros(8761,1);
for a = 1:hours
a_dk(a) = p_dk(a)/d_dk(a);
a_be(a) = p_be(a)/d_be(a);
end
C = 6647000000; % DKK
T = 1400; % (MW) transmission line capacity for viking link
l = 770; % (km) length of viking link cable
n = 40; % (Years) lifteime of the cable
LRMC = ((C/(T*l*n)*l)/hours); % Long run marginal cost DKK/MW
for i = 1:hours
syms F
pi(F) = (a_be(i)*(d_be(i)-F))-(a_dk(i)*(d_dk(i)+F));
F = finverse(pi); %inverse supply function
T_opt = vpa(subs(F,LRMC),4)
end
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Time Series Objects 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!