Finding frequency of repetition of a data point in a pattern
Mostrar comentarios más antiguos
I have data which has 48 data points. Please see attached figure which represents the plot of the data points. Now i need to know the frequency of certain points in the plot e.g. point 1 which is repeated twice, the bottom point is repeated only once and similarly some other points. I have got 48 data points in total but the point i am looking for might not repeat itself in the data, however, it might lie between two data points. I have tried to check the frequency of occurrence of such data points using the following code but am not getting the results as they should.
[a, b]=size(Linear_fit1);
fq=0;
for i=1:a
for j=1:n-1
idx = (Final_Load(1,j)>=Linear_fit1(i,2)>=Final_Load(1,j+1))| ...
(Final_Load(1,j)<=Linear_fit1(i,2)<=Final_Load(1,j+1 ));
if idx==1
fq=fq+1
else
fq
end
end
Frequency(i,:)={Linear_fit1(i,2),fq}
fq=0
So what i did here is, took the point which i needed to check the frequency of, then i check if it lies between two consecutive data points. I believe i am making some mistake in the setting the criteria which make the process go wrong. Can anyone help me with this or preferably if there is a simpler way to do it more quickly and accurately. Just to clarify i am not bothered about the index, i just need the frequency (number of times the line passes through that value)!
1 comentario
dpb
el 15 de Jun. de 2017
for j=1:n-1
What's n?
idx = (Final_Load(1,j)>=Linear_fit1(i,2)>=Final_Load(1,j+1))| ...
(Final_Load(1,j)<=Linear_fit1(i,2)<=Final_Load(1,j+1 ));
I presume Linear_fit1 is the result of a linear regression over the data?
Why is the same identical expression in the logical expression on both sides of an OR operator?
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!