How to Create Basic Waveform Functions in MatLab?

  • Context: MATLAB 
  • Thread starter Thread starter olen501
  • Start date Start date
  • Tags Tags
    Matlab
Click For Summary
SUMMARY

This discussion focuses on creating basic waveform functions in MatLab, specifically the unit step function, triangle function, rectangle function, and saw-tooth function. The unit step function can be implemented using a for loop or by concatenating vectors. The triangle function can be elegantly created through the convolution of two rectangle functions. For Fourier series and transforms, users can utilize MatLab's built-in FFT routine with the command A = FFT(B), and the Signal Processing Toolbox offers functions like "sawtooth" and "square" for generating specific waveforms.

PREREQUISITES
  • Familiarity with MatLab programming
  • Understanding of waveform functions
  • Knowledge of Fourier series and transforms
  • Experience with the Signal Processing Toolbox in MatLab
NEXT STEPS
  • Learn how to implement convolution in MatLab for waveform generation
  • Explore the use of the "zeros" and "ones" functions in MatLab
  • Study the Signal Processing Toolbox functions for waveform generation
  • Investigate advanced FFT techniques and optimizations in MatLab
USEFUL FOR

MatLab users, signal processing engineers, and anyone interested in generating and analyzing waveforms using MatLab.

olen501
Messages
6
Reaction score
0
Hey I'm new to this forum and I need some MatLab help. I need to make a unit step function , a triangle function, a rectangle function, and a saw function. How can I do that in MatLab? After that I need to find the Fourier series and transforms of those. Can anyone help me out?
 
Physics news on Phys.org
The unit step function is just a series of 0's and 1's. That is easily written either using a for loop, or concantenating two vectors together, almost the same thing for the rectangle function. Now the triangle function can either be written as a function, or more elegantly as the convolution of two rectangle functions. The saw-tooth is just a finite linear line concantinated with itself a bunch of times.

As for the FFt's of these, they are very simple, Matlab has an FFT routine, just type in A =FFT(B) and they pop right out. If the input vectors are not powers of two long, there is another function, look in the help file, it is very very helpful, more so than any I have ever seen.
 
In the signal processing toolbox there are functions called "sawtooth" and "square" that generate certain waveforms. If you wanted to code your own or if you don't have the signal processing toolbox, you might look into using the functions "zeros" and "ones."
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
Replies
5
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 6 ·
Replies
6
Views
2K