help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Filtering a Matrix


From: Oscar Bayona Candel
Subject: Filtering a Matrix
Date: Thu, 30 Aug 2007 15:51:26 +0200

Hi I ve got two problems programming with octave that I  can´t solve but I know that should be easy to solve.
 
First,
I´ve got a matrix Z.
 
 
 

Z=[

1,02  0,019 0,018 3,113 0,112 0,111

0,021 0,02  0,019 0,104 0,103 0,102

0,022 0,021 0,02  0,095 0,094 0,093

0,023 0,022 0,021 0,086 0,085 0,084

0,024 0,023 0,022 0,077 0,076 0,075

0,025 0,024 0,023 0,068 0,067 0,066

0,034 0,033 0,032 0,059 0,058 0,057

0,043 0,042 0,041 0,05  0,049 0,048

0,052 0,051 0,05  0,041 0,04  0,039

0,061 0,06  0,059 0,032 0,031 0,03

0,07  0,069 0,068 8,023 0,022 0,021

0,079 0,078 0,077 0,022 0,021 0,02

0,088 0,087 0,086 0,021 0,02  0,019

0,097 0,096 0,095 0,02  0,019 0,018

0,106 0,105 0,104 0,019 0,018 0,017

1,15 0,114 0,113 0,018 0,017 0,016

];

 

 

[nf,nc]=size(Z);

 

i=find(Z>=0.07);

 

Z=0.07;

 

j=find(Z<0.0375);

 

Z=0

 

If I execute this in an user defined function it shows a new Z with values > 0.06 with 0.07 and values < 0.0375 equal to 0.

 

 

MY PROBLEM IS: HOW CANI EXECUTE (PROGRAM) TWO NEW ADITIONNAL ORDERS LIKE THESE ??

if you find a value in any row or colum between 0.05 and 0.06 replace with 0.02

 

and also at the same time if you find any value in the matrix between 0.04 an 0.045 put 1.

 

 

 

So my first problem is how to replace any value in a original matrix  at the same time to obtain a new one "filtering" by for conditions to the original matrix at the same time

 

All Values from the original matrix  Z>0.07----->0.07 (replace with 0.07)

All Values from the original matrix  Z<0.0375----->0 (replace with 0)

All Values from the original matrix between 0.05<Z<0.06----->0.02 (replace to 0.02)

All Values from the original matrix between 0.04<Z<0.045----->1 (replace to 1)

 

 

 

Second,

 

I have tried only to download/save in a different file the output of a file in a txt or xls so I type save Z.doc or Z.xls and in this way it creates a new file but appears all the code....and not the result.

 

 

THANKS IN ADVANCE TO EVERY ONE.

 

 



Consigue el nuevo Windows Live Messenger Pruébalo

reply via email to

[Prev in Thread] Current Thread [Next in Thread]