Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Topic: Thresholding
Replies: 2   Last Post: Apr 4, 2013 11:56 PM

 Messages: [ Previous | Next ]
 Nasser Abbasi Posts: 6,315 Registered: 2/7/05
Re: Thresholding
Posted: Apr 4, 2013 11:50 PM

On 4/4/2013 10:44 PM, Thomas Bunn wrote:
> What is the MatLab function for the following routine?
>
> for n=1:N+1
> for m=1:N+1
> if F(n,m)>Thresh;
> F(n,m)=F(n,m) - Thresh;
> else
> F(n,m)=0;
> end
> end
> end
>
> Thanks for the tip.
>

EDU>> F=rand(5);
F =
0.8147 0.0975 0.1576 0.1419 0.6557
0.9058 0.2785 0.9706 0.4218 0.0357
0.1270 0.5469 0.9572 0.9157 0.8491
0.9134 0.9575 0.4854 0.7922 0.9340
0.6324 0.9649 0.8003 0.9595 0.6787

EDU>> thresh=.5;
EDU>> F(F<thresh)=0

0.8147 0 0 0 0.6557
0.9058 0 0.9706 0 0
0 0.5469 0.9572 0.9157 0.8491
0.9134 0.9575 0 0.7922 0.9340
0.6324 0.9649 0.8003 0.9595 0.6787

EDU>> F(F>=thresh)=F(F>=thresh)-thresh

0.3147 0 0 0 0.1557
0.4058 0 0.4706 0 0
0 0.0469 0.4572 0.4157 0.3491
0.4134 0.4575 0 0.2922 0.4340
0.1324 0.4649 0.3003 0.4595 0.1787

Date Subject Author
4/4/13 Thomas Bunn
4/4/13 Nasser Abbasi
4/4/13 Thomas Bunn