Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: how to enter into vector with variables
Replies: 4   Last Post: Nov 7, 2013 1:20 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
dpb

Posts: 8,102
Registered: 6/7/07
Re: how to enter into vector with variables
Posted: Nov 7, 2013 1:20 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 11/7/2013 11:53 AM, goatfish wrote:
> how do i create an 11-entry 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.


And to amplify on how to see someone's solution or to attack in general,
write the algebraic expression you're trying to implement first in as
general a form as can--

x=[a+0*(0.5), a+1*(0.5), a+2*(0.5)........ a+10*(0.5)]
= a*[0*(0.5), 1*(0.5), 2*(0.5)........ 10*(0.5)]
= a*0.5*[0, 1, 2 ........ 10]

and the next steps should become apparent. The idea is generic, not
just for the specific problem.

--



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.