How to store answers from function in array?
2 views (last 30 days)
Show older comments
Mads Andersen
on 30 Apr 2018
Answered: Walter Roberson
on 30 Apr 2018
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 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Time Series Objects in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!