read data. dat
read data. dat
(OP)
I'm doing the reading of a file. DAT, need to read the columns and make some calculations, my concern is this, each column are values of speed, these values will either increase or decrease up to a nearly constant value,
Almost constant, because when it reached steady state, the values fluctuate slightly neighborhood of a constant value that would be the stable speed, but there is no tendency to grow or decline (line with zero slope).
Now I must read the data from the position it reaches the constant speed of calculations,
One idea was to calculate a slope when the slope is zero, this would be the rate constant value ... start reading the data for the calculations, but when it comes to the stable state or whether it varies slightly from one point to another, the slope can be positive or be negative, but neighborhood of a point,
I do not know how to read the data properly
thanks!
m=csvread('LES9.dat', 1, 0); % Read data
unums = [2 3 5 6 7 8 9 10 11 12 4 13 14 16 17 18 19 20 21 22 23 15];
% I'd like to start reading each column from reaching a nearly constant velocity.
for i = 1:length(unums)
un = unums(i);
u(:,i) = m(:,un);
Y=abs(fft(u(:,i)))/length(u);
n=length(Y);
power(:,i) = abs(Y(1:floor(n/2))).^2/;
nyquist = 1/2;
freq = ((1:n/2)/(n/2)*nyquist)';
% regresion de todos los puntos
[a0,a1]=Linear_regression(log10(freq),log10(power(:,i)));
%a1 = -5/3; % para que la linea tenga pendiente definida
%a0 = log10(power(3000,i)) - (-5/3)*log10(freq(3000));% usando el dato medio
powerfit(:,i) = 10.^(a0 + a1*log10(freq));%reg todo.
a0_matriz(i) = a0;
a1_matriz(i) = a1
M=a1_matriz';
B=(1-i)/10; % indica la altura en metros do ponto de monitoreamento no Riser
% PLOT HORIZONTAL IMPAR %
if i<12 && mod(i,2)==1
subplot(2,6,(i/2+0.5));
loglog(freq,power(:,i),'b',freq,powerfit(:,i),'k:');
L2 = ['h = ' num2str(-B) ' m'];
L3 = ['m = ' num2str(a1,3)];
title({L2;L3},'FontSize',8);
%axis tight;
elseif i>=12 && mod(i,2)==0
subplot(2,6,(i/2+1));
loglog(freq,power(:,i),'b',freq,powerfit(:,i),'k:');
%L2 = ['h = ' num2str(-B) ' m'];
L3 = ['m = ' num2str(a1,3)];
title({L3},'FontSize',8);
%axis tight;
%set(gca,'xtick',[],'ytick',[])
[ax1,h1]=suplabel('super X label');
[ax2,h2]=suplabel('super Y label','y');
%set(h1,'\bf','FontSize',15);
H=labelEdgeSubPlots('\fontsize{14}\bf\kappa (Hz)','\fontsize{12}\bfEnergia (J)',1);
end
end
Almost constant, because when it reached steady state, the values fluctuate slightly neighborhood of a constant value that would be the stable speed, but there is no tendency to grow or decline (line with zero slope).
Now I must read the data from the position it reaches the constant speed of calculations,
One idea was to calculate a slope when the slope is zero, this would be the rate constant value ... start reading the data for the calculations, but when it comes to the stable state or whether it varies slightly from one point to another, the slope can be positive or be negative, but neighborhood of a point,
I do not know how to read the data properly
thanks!
m=csvread('LES9.dat', 1, 0); % Read data
unums = [2 3 5 6 7 8 9 10 11 12 4 13 14 16 17 18 19 20 21 22 23 15];
% I'd like to start reading each column from reaching a nearly constant velocity.
for i = 1:length(unums)
un = unums(i);
u(:,i) = m(:,un);
Y=abs(fft(u(:,i)))/length(u);
n=length(Y);
power(:,i) = abs(Y(1:floor(n/2))).^2/;
nyquist = 1/2;
freq = ((1:n/2)/(n/2)*nyquist)';
% regresion de todos los puntos
[a0,a1]=Linear_regression(log10(freq),log10(power(:,i)));
%a1 = -5/3; % para que la linea tenga pendiente definida
%a0 = log10(power(3000,i)) - (-5/3)*log10(freq(3000));% usando el dato medio
powerfit(:,i) = 10.^(a0 + a1*log10(freq));%reg todo.
a0_matriz(i) = a0;
a1_matriz(i) = a1
M=a1_matriz';
B=(1-i)/10; % indica la altura en metros do ponto de monitoreamento no Riser
% PLOT HORIZONTAL IMPAR %
if i<12 && mod(i,2)==1
subplot(2,6,(i/2+0.5));
loglog(freq,power(:,i),'b',freq,powerfit(:,i),'k:');
L2 = ['h = ' num2str(-B) ' m'];
L3 = ['m = ' num2str(a1,3)];
title({L2;L3},'FontSize',8);
%axis tight;
elseif i>=12 && mod(i,2)==0
subplot(2,6,(i/2+1));
loglog(freq,power(:,i),'b',freq,powerfit(:,i),'k:');
%L2 = ['h = ' num2str(-B) ' m'];
L3 = ['m = ' num2str(a1,3)];
title({L3},'FontSize',8);
%axis tight;
%set(gca,'xtick',[],'ytick',[])
[ax1,h1]=suplabel('super X label');
[ax2,h2]=suplabel('super Y label','y');
%set(h1,'\bf','FontSize',15);
H=labelEdgeSubPlots('\fontsize{14}\bf\kappa (Hz)','\fontsize{12}\bfEnergia (J)',1);
end
end
RE: read data. dat