(adsbygoogle = window.adsbygoogle || []).push({}); 1. The problem statement, all variables and given/known data

Create 512 element triangular waveform (In Matlab)

x(k)= k 0≤k≤7

8-k 8≤k≤23

-32+k 24≤k≤31

For 0≤k≤31

repeating every 32 elements.

2. Relevant equations

N/A

3. The attempt at a solution

Ok so im confused on how to code this.

This is what I have so far.

k1=0:7;

k2=8:23;

k3=8-k2;

k4=24:31;

k5=-32+k4;

K=[k1,k3,k5];

Im not sure if this is the best way though. Or if this is correct.

How do I get it to repeat every 32 elements?

Thanks for any assistance!

1. The problem statement, all variables and given/known data

2. Relevant equations

3. The attempt at a solution

1. The problem statement, all variables and given/known data

2. Relevant equations

3. The attempt at a solution

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Creating a triangular waveform in Matlab

**Physics Forums | Science Articles, Homework Help, Discussion**