Looping through a column of data from start to end
1 view (last 30 days)
Show older comments
I need to loop through a column data set from start to end so I can calculate an equation.
The equation is given below. Gamma is a known value. CA, P_Pa, V_m3 are all given data that is sorted in a column. The issue that I am having is that when Q_dot_net is solved for, it only gives one value across the whole table. Q_dot_net should be changing based on the data. I am pretty sure this value is calculated from the last two data points in the set.
% read in the cylinder pressure from the excel file
[data] = xlsread('PressureME469.xlsx','PME469');
% split the data into CA and Pressure vectors
CA = data(:,1); % crank angle (deg. ATDC)
P = data(:,2); % cylinder pressure (bar)
P_Pa = P*1e5 % cylinder pressure converstion from bar to Pascal (Pa)
nCA = length(CA); % number of pressure points recorded
for i = 1:length(P_Pa);
for n = 1:length(CA);
for m = 1:length(V_m3);
Q_dot_net(n) = gamma/(gamma-1).*i.*(m-(m-1))/(n-(n-1)) + 1/(gamma-1) + m.*(i-(i-1))/(n-(n-1));
end
end
end
Q_dot_net = Q_dot_net.';
3 Comments
Answers (0)
See Also
Categories
Find more on Loops and Conditional Statements 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!