• Support PF! Buy your school textbooks, materials and every day products Here!

Matlab, for loop, sawtooth function

  • Thread starter mp252
  • Start date
  • #1
9
0
1.Hi! i am having problems plotting a sawtooth waveform without the use of the sawtooth function in matlab. I am required to produce a sawtooth waveform with a duty cycle of 30% using nested loops (for loop within a for loop) i have managed to get the ramp function from one, for loop,therefore it is a unit step, however i cannot manage to get the waveform to come down at 30%. I need to know how to create another for loop within the for loop to bring it down at 30%. Any help out there? I even tried to use an if statement but this did nothing. I managed to get another vector in there but it was wrong.





3. %SAWTOOTH WAVE PLOT

y=0:0.2:1
for j=0:0.2:1
a=(j)+y
end
figure(1)
plot(a,y)
 

Answers and Replies

Related Threads on Matlab, for loop, sawtooth function

  • Last Post
Replies
4
Views
9K
  • Last Post
Replies
3
Views
21K
  • Last Post
Replies
8
Views
1K
  • Last Post
Replies
22
Views
5K
Replies
10
Views
11K
Replies
1
Views
3K
  • Last Post
Replies
1
Views
1K
Replies
4
Views
1K
  • Last Post
Replies
2
Views
1K
Replies
4
Views
4K
Top