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

采纳的回答

Walter Roberson
Walter Roberson 2018-4-30
T_opt(i,:) = vpa(subs(F,LRMC),4);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Environment and Settings 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by