Path: news.mathworks.com!not-for-mail
From: Loren Shure <loren@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: greater than or less than
Date: Thu, 30 Aug 2007 16:51:55 -0400
Organization: The MathWorks
Lines: 58
Message-ID: <MPG.2140d13018f6f7989897af@news.mathworks.com>
References: <fb5j2h$2n2$1@fred.mathworks.com> <MPG.214081424ffda7f9897ad@news.mathworks.com> <fb70j0$mr6$1@fred.mathworks.com>
NNTP-Posting-Host: shurel.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-15"
Content-Transfer-Encoding: 7bit
X-Trace: fred.mathworks.com 1188507115 7902 144.212.219.159 (30 Aug 2007 20:51:55 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 30 Aug 2007 20:51:55 +0000 (UTC)
User-Agent: MicroPlanet-Gravity/2.70.2067
Xref: news.mathworks.com comp.soft-sys.matlab:426370


In article <fb70j0$mr6$1@fred.mathworks.com>, jr147@msstate.edu says...
> Loren Shure <loren@mathworks.com> wrote in message 
> <MPG.214081424ffda7f9897ad@news.mathworks.com>...
> > In article <fb5j2h$2n2$1@fred.mathworks.com>, 
> jr147@msstate.edu says...
> > > I am writing a program that is going to plot a 
> function. I 
> > > don't know the correct way to write a matlab function 
> that 
> > > will: 10<=x<=1.2*y   (1)
> > > 
> > > y=3.2
> > > 
> > > Whenever I type in the code as is, MatLab wants me to 
> > > define x. I am going to put x in another function, ex 
> > > 2.7+x=t. I am going to plot x vs. t. I just don't know 
> how 
> > > to tell MatLab to take values in between the range of 
> the 
> > > above stated values in equation (1).
> > > 
> > 
> > Perhaps an anonymous function will help...  It requires 
> that y be 
> > defined in advance, but not x.
> > 
> > between = @(x) (x >= 10) & (x < 1.2*y)
> > 
> > then use 
> > 
> > x = 1:20
> > out = between(x)
> > and you will get a logical vector saying where the 
> conditions are true 
> > and not.
> > 
> > -- 
> > Loren
> > http://blogs.mathworks.com/loren/
> 
> 
> "x=1:20"
> 
> Does this code mean that MatLab is taken values for x at 
> 20 equal increments?
> 
> 

Yes.  Perhaps you'd find it valuable to read the Getting Started section 
of the documentation:

http://www.mathworks.com/access/helpdesk/help/techdoc/learn_matlab/bqr_
2pl.html


-- 
Loren
http://blogs.mathworks.com/loren/