1 view (last 30 days)

HI

I have a plot of coninouts lines(from top 1,3,6) and discontinous lines. I like to retrieve only the continous line. How can i achieve it using polyfit. Please note that slope of continous and discontinous line is same.

Please see attached image

thanks

David Goodmanson
on 10 Nov 2020

Edited: David Goodmanson
on 10 Nov 2020

Hi salman,

I have been off taking a look at this problem. The method below uses the fact that what you call the discontinouus lines have matrix entries close to zero in every other column. In the code below, small values are set to zero in the diagnostic matrix m, both so the spy option can be used and so the discontinuous lines can be removed. Figures 2 and 3 illustrate the difference. Figure 4 shows the indices where the first column of the diagnostic matrix is nonzero. That's where the blob representing the 'continuous' lines cross the axis in the original image plot. I will leave it to you to determine which index to use for each line. Note that the values in the diagnostic matrix m have nothing to do with m77. The matrix iis just used to find indices, and to use spy.

It's true that asking the same question more than once on the website is not a good approach. Better to amend the original answer to make it more clear what you are aking.

m = 1e6*m77; % rescale matrix for convenience

figure(1)

imagesc(m)

colorbar

% matrix has no exact zeros, so create some when m is small

tol = 1e-2;

m(abs(m)<tol)= 0;

figure(2)

spy(m)

axis square

% 'discontinuous' lines are zero in every other column, eliminate them

m = m(:,1:2:end).*m(:,2:2:end);

figure(3)

spy(m) % only the 'continuous' lines are left

axis square

firstcol = m(:,1);

figure(4)

plot(abs(firstcol))

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

Start Hunting!
## 4 Comments

## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/643350-fitting-only-continous-line#comment_1123675

⋮## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/643350-fitting-only-continous-line#comment_1123675

## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/643350-fitting-only-continous-line#comment_1123755

⋮## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/643350-fitting-only-continous-line#comment_1123755

## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/643350-fitting-only-continous-line#comment_1123840

⋮## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/643350-fitting-only-continous-line#comment_1123840

## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/643350-fitting-only-continous-line#comment_1124110

⋮## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/643350-fitting-only-continous-line#comment_1124110

Sign in to comment.