Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

help required in matlab code

Status
Not open for further replies.

shaikh105

Member level 1
Joined
Jul 3, 2007
Messages
35
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Activity points
1,572
set threshold matlab

i want to capture following series of numbers into segments
as the series of numbers below show 4 segments
vector= [1 2 3 10 11 12 13 90 91 100 101 102 103 104 105 106.........]
ie.

seg1= 1 2 3
seg2= 10 11 12 13
seg3= 90 91
seg4= 100 101 102 103 104 105 106
.............................upto seg(N)
i need help in making matlab code that searches such "seg" from within the "vector" and stores them individually as seg1, seg2, seg3,,,,seg(N).
can any body help me plz
 

text segmentation matlab

The problem you have proclaimed is very interesting and actual. As I've understood after having read your text fragment, you need the algorithm for automatic segmentation or automatic clusterisation. These techniques refer to Data Mining, which is intended for discovering new, non-trivial and practically useful knoledge.

Nowadays there exist numerous segmentation algorithms. I possess Matlab codes for the majority of them. Give me your e-mail, and I'll send you the pieces of Matlab codes.

These segmentation algorithms are the following:

1) Autoregressive models segmentation
2) Principal component segmentation
3) Segmentation based on smoothing
4) Statistical segmentation

etc.

These all are rather complicated algorithms and I can describe any of them (in brief) after just anyone's (including yours) request

Concerning clustering, most Matlab functions for it are already written and are located somewere in the Internet. There is a wonderful Matlab library PRTools, which can be found easily in the Internet. It comprises many algorithms of cluster analysis

Here I mention the most popular clustering algorithms:

1) k-means and its modifications
2) EM-clustering
3) Cobweb-clustering
4) Hierarchical clusterical (agglomerative and divising algorithms)

etc.

After studying these algorithms, try applying all of them to your vector. No doubt, at least several of them will provide the desired result.

With respect,

Dmitrij
 
threshold autoregressive model,matlab

Dmitrij said:
The problem you have proclaimed is very interesting and actual. As I've understood after having read your text fragment, you need the algorithm for automatic segmentation or automatic clusterisation. These techniques refer to Data Mining, which is intended for discovering new, non-trivial and practically useful knoledge.

Nowadays there exist numerous segmentation algorithms. I possess Matlab codes for the majority of them. Give me your e-mail, and I'll send you the pieces of Matlab codes.

These segmentation algorithms are the following:

1) Autoregressive models segmentation
2) Principal component segmentation
3) Segmentation based on smoothing
4) Statistical segmentation

etc.

These all are rather complicated algorithms and I can describe any of them (in brief) after just anyone's (including yours) request

Concerning clustering, most Matlab functions for it are already written and are located somewere in the Internet. There is a wonderful Matlab library PRTools, which can be found easily in the Internet. It comprises many algorithms of cluster analysis

Here I mention the most popular clustering algorithms:

1) k-means and its modifications
2) EM-clustering
3) Cobweb-clustering
4) Hierarchical clusterical (agglomerative and divising algorithms)

etc.

After studying these algorithms, try applying all of them to your vector. No doubt, at least several of them will provide the desired result.

With respect,

Dmitrij
i am thankful for this detailed information . Please find my email address
shaikh105@hotmail.com
 
agglomerative clustering matlab code

shaikh105 said:
i want to capture following series of numbers into segments
as the series of numbers below show 4 segments
ie.

seg1= 1 2 3
seg2= 10 11 12 13
seg3= 90 91
seg4= 100 101 102 103 104 105 106
.............................upto seg(N)
i need help in making matlab code that searches such "seg" from within the "vector" and stores them individually as seg1, seg2, seg3,,,,seg(N).
can any body help me plz

If I understand what you need, then I'd suggest something that begins with:

% Set threshold for distance between segments
threshold = 5;

% Generate vector of segment labels
SegmentLabel = cumsum([1 diff(vector) > threshold])

SegmentLabel =

1 1 1 2 2 2 2 3 3 4 4 4 4 4 4 4

Picking out the individual segments should be easy, from this point:

>> seg1 = vector(SegmentLabel == 1)

seg1 =

1 2 3

>> seg2 = vector(SegmentLabel == 2)

seg2 =

10 11 12 13

...and so on.


-Will
https://matlabdatamining.blogspot.com/
 

segmentation matlab code

Predictor said:
shaikh105 said:
i want to capture following series of numbers into segments
as the series of numbers below show 4 segments
ie.

seg1= 1 2 3
seg2= 10 11 12 13
seg3= 90 91
seg4= 100 101 102 103 104 105 106
.............................upto seg(N)
i need help in making matlab code that searches such "seg" from within the "vector" and stores them individually as seg1, seg2, seg3,,,,seg(N).
can any body help me plz

If I understand what you need, then I'd suggest something that begins with:



% Set threshold for distance between segments
threshold = 5;

% Generate vector of segment labels
SegmentLabel = cumsum([1 diff(vector) > threshold])

SegmentLabel =

1 1 1 2 2 2 2 3 3 4 4 4 4 4 4 4

Picking out the individual segments should be easy, from this point:

>> seg1 = vector(SegmentLabel == 1)

seg1 =

1 2 3

>> seg2 = vector(SegmentLabel == 2)

seg2 =

10 11 12 13

...and so on.


-Will
https://matlabdatamining.blogspot.com/


its nice ,, i am greatful but there iz one problem i want to incorporate a loop as u can see below:
d1 is my vector
i want to get seg1, seg 2,,,,,,,,,,, by doing as below,,, but it is working as below but not as ""seg(jk)""
because segjk gives the last segment of my vector d1,,, whereas i need the loop run and finally gives me all these and as many segments seg1 , seg2 ,seg3,,,, seg(N) present in my vector d1,,,,,,,,,, i hope i conveyed my problem . i am thankful for ur knd help
regards


threshold = 5;
% Generate vector of segment labels
SegmentLabel = cumsum([1 diff(d1) > threshold]);

for jk=1:max(SegmentLabel)
segjk = d1(SegmentLabel == jk);

end
 

matlab code for non-trivial solution

Here is an entire solution:

>> vector= [1 2 3 10 11 12 13 90 91 100 101 102 103 104 105 106]

vector =

1 2 3 10 11 12 13 90 91 100 101 102 103 104 105 106

>> % Set threshold for distance between segments
threshold = 5;

% Generate vector of segment labels
SegmentLabel = cumsum([1 diff(vector) > threshold])

SegmentLabel =

1 1 1 2 2 2 2 3 3 4 4 4 4 4 4 4

>> nSegments = max(SegmentLabel)

nSegments =

4

>> for i = 1:nSegments, eval(['seg' int2str(i) ' = vector(SegmentLabel == ' int2str(i) ')']), end

seg1 =

1 2 3


seg2 =

10 11 12 13


seg3 =

90 91


seg4 =

100 101 102 103 104 105 106


...but you may want to consider using cell arrays instead, like this (note the use of curly braces, {}, to index the cell array):


>> SegmentCell = cell(1,nSegments);
>> for i = 1:nSegments, eval(['SegmentCell{' int2str(i) '} = vector(SegmentLabel == ' int2str(i) ');']), end
>> SegmentCell{1}

ans =

1 2 3

>> SegmentCell{2}

ans =

10 11 12 13

>> SegmentCell{3}

ans =

90 91

>> SegmentCell{4}

ans =

100 101 102 103 104 105 106



-Will
 

setting thresholds using matlab code

i am really thankful to all of you
kind regards
 

Hi, am sure you must have solved this threshold problem already. I was wondering if perhaps you can help me with mine am having a similar problem with an algorithm am working on and since am fairly new to matlab am having difficulties. I have this stock data am working on doing some time series analysis. I took the regression of the data and found the residual error of the data. This error increases as the data increases in time so what I want to do now is to set a threshold to prevent the error from exceeding that threshold. Please if you still have the codes provided to you by dimitij it will be very useful my email address is cnn4@njit.edu thanks.
 

Re: text segmentation matlab

Hi,

I am working on text segmentation and looking for Matlab code. I just see this discussion. could you please send me the codes that you mentioned in your post?

Many thanks,
LaLa



The problem you have proclaimed is very interesting and actual. As I've understood after having read your text fragment, you need the algorithm for automatic segmentation or automatic clusterisation. These techniques refer to Data Mining, which is intended for discovering new, non-trivial and practically useful knoledge.

Nowadays there exist numerous segmentation algorithms. I possess Matlab codes for the majority of them. Give me your e-mail, and I'll send you the pieces of Matlab codes.

These segmentation algorithms are the following:

1) Autoregressive models segmentation
2) Principal component segmentation
3) Segmentation based on smoothing
4) Statistical segmentation

etc.

These all are rather complicated algorithms and I can describe any of them (in brief) after just anyone's (including yours) request

Concerning clustering, most Matlab functions for it are already written and are located somewere in the Internet. There is a wonderful Matlab library PRTools, which can be found easily in the Internet. It comprises many algorithms of cluster analysis

Here I mention the most popular clustering algorithms:

1) k-means and its modifications
2) EM-clustering
3) Cobweb-clustering
4) Hierarchical clusterical (agglomerative and divising algorithms)

etc.

After studying these algorithms, try applying all of them to your vector. No doubt, at least several of them will provide the desired result.

With respect,

Dmitrij
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top