Calculate the correlation coefficient at 0.5 , 0.7 and 0.9

2 visualizaciones (últimos 30 días)
yusra Ch
yusra Ch el 14 de Oct. de 2016
Comentada: Star Strider el 14 de Oct. de 2016
I want to find the correlation coefficient at 0.5 , 0.7 and 0.9 this is the code I use :
for a=1:114
power=pote(a,:);
mean_power_50=filter(ones(1,50)/50,1,power);
power_fading=power-mean_power_50;
x1(a,:)=power_fading(51:1050);
%%%%%%%%%%%%% interpolation linear %%%%%%%%%%%%%%
X = linspace(-1000,1000,1999)*1.03 ; % x1
Y = xcorr(x1(a,:),'coeff');
ystar=0.5;
%%%%%%%%%%Find x0, x1 & y0 , y1 %%%%%% Find y0 < Ystar < y1 %%%%%%%%%
Look = find(ystar < xcorr(x1(a,:),'coeff'),1);
x_1 = X(Look);
x_0 = X(Look-1);
y_1 = Y(Look);
y_0 = Y(Look-1);
m =(y_1-y_0)/(x_1-x_0);
xstar=((ystar-y_0)/m)+x_0; ystar=y_0+m*(xstar-x_0); % relation of linear intrpolation
But the resut is a point(xstar,ystar) where ystar is not exactly 0.5 and xstar is not on the line of my signal.

Respuestas (1)

Star Strider
Star Strider el 14 de Oct. de 2016
If you want to interpolate to find the most precise value, the approach in How to find 3db lower and upper frequency bound for frequency response of this problem? is likely what you want to adapt to your code.
  2 comentarios
yusra Ch
yusra Ch el 14 de Oct. de 2016
I didn't understand the other code
Star Strider
Star Strider el 14 de Oct. de 2016
I cannot follow or run your code. I will describe my code.
It works by first subtracting the value you want from the data you have, to create zero-crossings. It then uses the ‘zci’ function to find the approximate vector indices of the zero-crossings, and returns them in the ‘db3idx’ vector. You have probably already done that with your ‘Look’ variable, so you can skip that part. Your ‘Look’ vector is essentially my ‘db3idx’ vector.
The loop iterates through those indices, creating a range of vector indices in the ‘idxrng’ assignment that the interp1 function uses to find the desired, more precise, values. It returns them in the ‘db3’ vector. The ‘db3’ vector will contain the values you want.
It then plots them with the original data, since that was the original objective. Don’t plot them if you don’t need to.

Iniciar sesión para comentar.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by