필터 지우기
필터 지우기

How to get the rgression line tangent to the curve

조회 수: 2 (최근 30일)
Mahesh
Mahesh 2015년 6월 6일
댓글: Star Strider 2015년 6월 7일
I have a sample code which allows us to compute the correlation dimension as follows.
function [obj] = correldim(X)
N = numel(X);
arrayDist = zeros(N, N);
for i = 1:N
x1 = X(i);
for j = 1:N
x2 = X(j);
arrayDist(i,j) = abs(x1-x2);
end
end
Nr = 20;
r = linspace(0.0005, 0.015, Nr);
for k = 1:numel(r);
countk = find(arrayDist >= r(k));
cr(k) = numel(countk);
end
logr = log10(r);
logcd = log10(cr);
hold on
plot(logr, logcd)
[dimc, se]= polyfit(logr, logcd, 1);
f = polyval(dimc,logr);
plot(logr, f)
hold off
xlabel('log\epsilon');
ylabel('logC(\epsilon)');obj.cd = dimc(1);
box on
end
I noticed that while plotting the regression line using ployfit with order 1, the line crosses the curve. It looks to me the coefficient of regression line is not feasible. Could please help me how to do in exact way. I have attached the figure and code for your reference.
Thanks
Mahesh
  댓글 수: 2
Image Analyst
Image Analyst 2015년 6월 6일
You forgot to give us x. Make it easy for us to run your code and help you, not hard.
Mahesh
Mahesh 2015년 6월 7일
Thank you for your response
X = load('Data_1.txt');
X = X/sum(X);
[obj] = correldim(X)
I hope it works for you to help me. Thank you for your kind cooperation

댓글을 달려면 로그인하십시오.

채택된 답변

Star Strider
Star Strider 2015년 6월 6일
If I remember correctly (and from the Wikipedia article on Correlation dimension), you don’t need to plot the log-log regression line.
You are doing the regression to estimate the correlation dimension, and the correlation dimension is the slope of the log-log regression, or dimc(1).
  댓글 수: 2
Mahesh
Mahesh 2015년 6월 7일
If so, that's fine. But I am seeking for generic one. If you have some clues, kindly let me know. Thanks for your response.
Star Strider
Star Strider 2015년 6월 7일
My pleasure.
I will see what I can find.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by