필터 지우기
필터 지우기

How to store answers from function in array?

조회 수: 2 (최근 30일)
Mads Andersen
Mads Andersen 2018년 4월 30일
답변: Walter Roberson 2018년 4월 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