How can I create this sort of list or 1xn matrix?

Hi guys I'm relatively new to matlab, I'd be grateful if somebody could help me out with this problem..
I have these equations..
n1=10
n2=n1+5
n3=n2+5
n4=n3+5
n5=n4+5
and so on..
I want to be able to create a list of the answers to all of these up to a certain value. For example up to n3:
10
15
20
Is there a way for me to do this on matlab up to any n number i wish? i.e. n500 if i wanted.

Answers (2)

First, don't define variables like this. Instead create a vector:
nv = 10:5:500;
Now you can index into it
nv(1)
nv(3)

Products

Asked:

on 26 Feb 2013

Community Treasure Hunt

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

Start Hunting!