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 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
 

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
 

Re: Programmin help!

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

Programmin help!

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

Re: Programmin help!

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

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

Back
Top