How to divide a curve into 8 equal region along x axis?

11 visualizaciones (últimos 30 días)
joynob ahmed
joynob ahmed el 19 de Jun. de 2020
Comentada: joynob ahmed el 3 de Jul. de 2020
Hi. I am working with border irregularity. For this I have determined the irregularities in the curve. Here the 'stars' indicate the irregularities. I want to divide it into 8 parts so that if any part contains minimum one star I can count it as 1. So if all the 8 parts have stars in each,the value will be 8. So the final value will be of any between 0 to 8. How can I do this?
I have attached my code and the image.
  2 comentarios
KSSV
KSSV el 19 de Jun. de 2020
How about using reshape?
joynob ahmed
joynob ahmed el 22 de Jun. de 2020
But when I used reshape it didn't give me the distribution of star in that way

Iniciar sesión para comentar.

Respuesta aceptada

KSSV
KSSV el 19 de Jun. de 2020
A = rand(1,100) ;
a = length(A) ;
n = 8 ;
% check whether data needed to be appended to reshape into n
b = n * ceil(a / n)-a ;
%
A = [A NaN(1,b)] ;
iwant = reshape(A,n,[]) ;
% plot
plot(iwant)
  13 comentarios
joynob ahmed
joynob ahmed el 26 de Jun. de 2020
Editada: joynob ahmed el 3 de Jul. de 2020
But this code reshapes such that the first 8 point fall into 8 different region where as I wanted to divide so that 1st 497 points which means all the point in first region to be in the x=1.I have checked the result.If I do so the result won't be correct.
Is there any way to rearrange this?
joynob ahmed
joynob ahmed el 3 de Jul. de 2020
It works when I changed the row and column of the matrix. Thank you for your answer.

Iniciar sesión para comentar.

Más respuestas (1)

John D'Errico
John D'Errico el 20 de Jun. de 2020
Editada: John D'Errico el 20 de Jun. de 2020
I am surely wasting my time (and yours) to answer this, because I don't understand the question. Far too confusingly posed to make sense. I think you are asking how to break the curve into exactly 8 parts, each as equal in length as possible. I can only assume you mean distance traveled along the curve, so arclength. Sadly, arclength is not terribly well defined on a noisy curve, but that is something only you can deal with. I'd assume just a piecewise linear arclength, so a connect-the-dots curve.
Next, you insist that one of those stars MUST appear in each segment. The starred points "seem" to be zero-crossings, but even that is not clear. Are the stars every zero crossing of this noisy curve? How did you choose those points? Can a starred point be shared across two segments? That is, if a starred point lies at the break point between two segments, is that sufficient?
Next, what is the point of this task? What is your goal?
I ask that question because far too often I see people ask a specific confusing question on Answers, when their real goal is something relatively simple to solve, IF they knew how to solve that problem. So, is your goal in this task to locate those roots/zero crossings?
If you really wanted to break the curve into segments that are all roughly as much as possible equal in length, such that each segment MUST include at least one of those starred points. Then...
Find the total arc length along the curve.
Break the curve into 8 segments, where each segment has the same arc length. I have posted a tool on the file exchange which can do exactly this. Test to see if each segment contains at least one starred point. If not, then adjust the segment lengths, perhaps using an optimization tool, until the goal is satisfied.
If your final goal is something different, so as I suggested, it is merely to find the zero crossings of that function, there are tools that can do this trivially in one call.
  3 comentarios
Image Analyst
Image Analyst el 22 de Jun. de 2020
So is the minimum for a 1/8th segment of x one star or zero stars?
And I do not understand the grammar of this sentence: "Then I want to see if each splitted region/part got minimum 1 abrupt cutoff." It seems there are some crucial words missing in that sentence.
joynob ahmed
joynob ahmed el 22 de Jun. de 2020
when a region got star,its value will be 1. Abrupt cut off indicates star here.

Iniciar sesión para comentar.

Categorías

Más información sobre Programming en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by