Path: news.mathworks.com!not-for-mail From: "Ender " <jr147@msstate.edu> Newsgroups: comp.soft-sys.matlab Subject: Re: greater than or less than Date: Fri, 31 Aug 2007 21:07:20 +0000 (UTC) Organization: NASA Marshall Space Flight Ctr Lines: 99 Message-ID: <fb9vu8$q30$1@fred.mathworks.com> References: <fb5j2h$2n2$1@fred.mathworks.com> <MPG.214081424ffda7f9897ad@news.mathworks.com> <fb70j0$mr6$1@fred.mathworks.com> <MPG.2140d13018f6f7989897af@news.mathworks.com> Reply-To: "Ender " <jr147@msstate.edu> NNTP-Posting-Host: webapp-03-blr.mathworks.com Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Trace: fred.mathworks.com 1188594440 26720 172.30.248.38 (31 Aug 2007 21:07:20 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Fri, 31 Aug 2007 21:07:20 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 1035766 Xref: news.mathworks.com comp.soft-sys.matlab:426529 Loren Shure <loren@mathworks.com> wrote in message <MPG.2140d13018f6f7989897af@news.mathworks.com>... > 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/ I tried to access the getting started section but the page didn't display. I have a question and maybe I didn't phrase what I wanted properly. I am trying to take values from 10<=x<=46.75 I want to make an (i) iteration loop that will take values at specified increments between 10 and 30. I plan on stating x(i) within this loop. How do I do this? I tried to accomplish the above stated task this way, but it didn't work. I wrote code that looked vary similiar to this for i=10:1:46.75 x(i)=10*i y(i)=3+x(i) end I then plotted a graph in Excel to show my results. Whenever I try to change the "1" to "0.001" to get a more refined value in my graph. MatLab gave me this answer. ??? Attempted to access sig_AL_cr(0.001); index must be a positive integer or logical I don't know why?