Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.



Re: how to enter into vector with variables
Posted:
Nov 7, 2013 1:20 PM


"someone" wrote in message <l5gl24$j1l$1@newscl01ah.mathworks.com>... > "goatfish" wrote in message <l5gk25$rck$1@newscl01ah.mathworks.com>... > > how do i create an 11entry vector x given by > > > > x=[a, a+1*(0.5), a+2*(0.5)........ a+10*(0.5)] > > > > I know that something like x=1:1:5 gives x=[1,2,3,4,5]. But i am confused how to increment something with only some of the variables increasing while the others stay the same. i.e 0.5 and a is constant and 0:10 is increasing. > > % Here's one way (showing all the steps) > > x = 0:1:10; > x = 0.5*x; > x = a + x; > > % All together now: > > x = a +0.5*(0:10) >
Thank you very much. I now understand how it works. Much appreciated! > % or > > x = a + (0:0.5:5)



