Combine two rows of data into a single matrix.

조회 수: 7 (최근 30일)
CJ
CJ 2016년 4월 7일
답변: CJ 2016년 4월 7일
After solving two different equations, I get a 1x7 matrix for the answer to Clt and a 1x7 matrix for the answer to THM. I need to merge the two into a 2x7 matrix with both data sets. Here is my code:
% Set initial paramters.
Cl_initial=3;
R=0.5;
u=0.5;
T=40;
t=[68.92 109.97 287.22 116.95 171.89 90.3 103.54];
Nt = length(t);
Clt = zeros(1,Nt);
THM = zeros(1, Nt);
result = zeros(2, Nt);
% Solve for Chlorine residual.
for i = 1:Nt
Clt(i) = [Cl_initial*(1-R)/(1-R*exp(-u*t(i)))];
end
% Solve for THM formation.
NClt = length(Clt);
for j = 1:NClt
THM(j) = T*(Cl_initial-Clt(j));
end
Any help would be appreciated.
  댓글 수: 1
CJ
CJ 2016년 4월 7일
Or, if I could figure out how to place both sets of data into a 2x7 matrix as the data is calculated, that might be better.

댓글을 달려면 로그인하십시오.

채택된 답변

CJ
CJ 2016년 4월 7일
I found the following solution:
result = [Clt; THM];
Let me know if there is a better way.

추가 답변 (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