Populating column Vector containing 200 17's followed by 300 -11's

I am having extreme trouble trying to figure out how to do a homework question.
The question is asking:
Create a 500-element Column vector P17M11 containing two hundred number seventeens followed by three hundred number negative elevens.

7 Comments

Could you possibly elaborate on how to use repmat to do this? I tried working with it for an hour and i have gotten no where.
What have you done with repmat? What have you tried?
It replicates the first argument in a matrix whose size is given by the second (#rows) and third (#columns) arguments.
Another option is the ones function, with scalar multiplication.
The best i was able to do was Replicate only 1 number.
I tried doing P17M11 = repmat(17,1,200);
I searched and i don't know what else i can add to it to add the three hundred -11 after it.
Do the same thing with -11, then concatenate the two vectors.
Thanks Star Strider. I was able to figure it out. I'm new to this language and didn't realize it was that simple :)
Type
doc
and then click on the "Getting Started" tab and work thru the tutorials on basic Matlab syntax and operations.

Sign in to comment.

Answers (0)

Categories

Find more on Scripts in Help Center and File Exchange

Asked:

on 30 Jan 2015

Commented:

dpb
on 30 Jan 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!