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 me with a matrix in Matlab programming

Status
Not open for further replies.

ramone

Member level 3
Joined
Oct 5, 2003
Messages
58
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Location
Patras University
Activity points
721
Programmin help!

Hi there i have this matrix:
1 1 1 1 1 -1 -1 -1
1 6 6 6 1 -1 -1 -1
1 6 6 5 1 1 1 1
1 1 1 1 1 1 1 1
1 -1 -1 -1 1 6 6 1
1 -1 -1 -1 1 6 6 1
1 -1 -1 -1 1 1 1 5

what i want to do is to give a special number to each special region:
- you can see 2 regions with 6s and a 5...i want to fill the first of this region
with 2s and the second with 3s

does anyone know the way... i am programming in matlab
 

echo47

Advanced Member level 5
Joined
Apr 7, 2002
Messages
3,942
Helped
638
Reputation
1,274
Reaction score
89
Trophy points
1,328
Location
USA
Activity points
33,176
Programmin help!

Do you want MATLAB to search for the two regions?

Or do you simply want to replace two fixed rectangular groups of cells with a constant, like this?
Code:
a = [1  1  1  1  1 -1 -1 -1
     1  6  6  6  1 -1 -1 -1
     1  6  6  5  1  1  1  1
     1  1  1  1  1  1  1  1
     1 -1 -1 -1  1  6  6  1
     1 -1 -1 -1  1  6  6  1
     1 -1 -1 -1  1  1  1  5];

a(2:3,2:4) = 2;

a(5:7,6:8) = 3;

a
a =
     1     1     1     1     1    -1    -1    -1
     1     2     2     2     1    -1    -1    -1
     1     2     2     2     1     1     1     1
     1     1     1     1     1     1     1     1
     1    -1    -1    -1     1     3     3     3
     1    -1    -1    -1     1     3     3     3
     1    -1    -1    -1     1     3     3     3
 

ramone

Member level 3
Joined
Oct 5, 2003
Messages
58
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Location
Patras University
Activity points
721
Re: Programmin help!

I want matlab to search (i want to be automatic for any matrix of this kind)
 

echo47

Advanced Member level 5
Joined
Apr 7, 2002
Messages
3,942
Helped
638
Reputation
1,274
Reaction score
89
Trophy points
1,328
Location
USA
Activity points
33,176
Programmin help!

You need to more clearly define the search criteria. One example is insufficient. In what ways could the matrix change?
 

jawadasheikh

Junior Member level 3
Joined
Nov 10, 2005
Messages
28
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
pakistan
Activity points
1,493
Re: Programmin help!

more details should be given or make good logic by considering linear aljebra book. eigen values or so.
 

Sceadwian

Full Member level 3
Joined
Sep 25, 2005
Messages
174
Helped
15
Reputation
30
Reaction score
0
Trophy points
1,296
Activity points
3,588
Programmin help!

It looks like you want a simple smoothing matrix. The matrix size you're looking for (the entries higher than 2) have to be clearly defined. But in your example the first 'blotch' is 3 wide by 2 tall and the 2nd one is 3 x 3 You have to more clearly define the nature of the out of range data you're trying to smooth. Specially it's maximum and minimum dimensions and values, and the possible ranges of the data that surrounds them.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top