- #1

- 228

- 0

x[n] = { 1 for 0<=n<=4

{ 0 elsewhere

im not sure how to do this, what I have tried is

x = [1 1 1 1]

but this is not a function of 'n'.

- Thread starter Larrytsai
- Start date

- #1

- 228

- 0

x[n] = { 1 for 0<=n<=4

{ 0 elsewhere

im not sure how to do this, what I have tried is

x = [1 1 1 1]

but this is not a function of 'n'.

- #2

olivermsun

Science Advisor

- 1,244

- 118

n = [0:10]; % or whatever you want your limits to be

x = zeros(1,length(n));

x(1:5) = 1

stem(n, x); % fancy plotting for discrete data

- #3

- 228

- 0

Thank you so much this is exactly what I was looking for!

- Replies
- 3

- Views
- 2K

- Replies
- 0

- Views
- 6K

- Last Post

- Replies
- 1

- Views
- 8K

- Replies
- 4

- Views
- 5K

- Last Post

- Replies
- 3

- Views
- 6K

- Last Post

- Replies
- 0

- Views
- 2K

- Replies
- 1

- Views
- 1K

- Replies
- 9

- Views
- 750

- Last Post

- Replies
- 5

- Views
- 2K

- Last Post

- Replies
- 1

- Views
- 859