Everytime time that I run my code, this error ocurrs:
Index exceeds matrix dimensions.Error in analyse_lbbc (line 17)m_flow(:,i)= v_flow(:,i)*de;
what should I do ? Thank You
function [v_flow,m_flow,v1,F_1,F_2,F_1_mean,F_2_mean]= analyse_lbbc(m,v,t);%create some variable
m=[0.4 0.3 0.2 0.1]; v=[0.003;0.003;0.003;0.003];t=[11.3 11.8 16.8 20.4];%save the variable m,v,t into one *.mat file
save data.mat m v t%load the data
load data.mat d= 0.005; %diameter
de=0.001; %density of the water
g=9.81; %gravity
A=(pi/4)*(d^2); %cross section area of the nozzle
c=0for i=1:4 v_flow(i,:)= v(i,:)./t(:,i); m_flow(:,i)= v_flow(:,i)*de; v1=v_flow(:,i)*A; F_1= m(:,i)*g; F_2= m_flow(:,i).*v1(:,i); end F_1_mean = mean(:,1:4); F_2_mean= mean(:,1:4); c=F_1_mean - m(:,1:4)*F_2_mean;
Best Answer