Help Plotting a Signal Waveform

Click For Summary
SUMMARY

This discussion focuses on plotting a waveform in MATLAB using 1000 data points. The user seeks guidance on creating a specific waveform defined by three segments: a value of 1 for the first 100 points, a value of 2 for the next 400 points, and a value of -5 for the final 500 points. The provided MATLAB code initializes a zero array and assigns values to specific ranges, followed by a plot command to visualize the waveform.

PREREQUISITES
  • Basic understanding of MATLAB programming
  • Familiarity with array manipulation in MATLAB
  • Knowledge of plotting functions in MATLAB
  • Concept of signal waveforms and data segmentation
NEXT STEPS
  • Explore MATLAB's plotting functions for advanced visualizations
  • Learn about MATLAB's array indexing techniques
  • Investigate signal processing concepts in MATLAB
  • Study MATLAB's data generation and manipulation functions
USEFUL FOR

This discussion is beneficial for MATLAB users, data analysts, and engineers interested in signal processing and waveform visualization.

Ugongorr
Messages
1
Reaction score
0
My mat lab skills are pretty low, basically i want to know how to make a waveform using 1000 points of data.

if the data is for example

y = 1 for 0<n<0.1
y = 2 for 0.1<n<0.5
y = -5 for 0.5 < n < 1

so how could i plot this waveform using 1000 points of data

cheers
 
Physics news on Phys.org
Try this and see what happens

y = zeros(1000);
for i=1:100
y(i) = 1;
end;
for i=101:500
y(i) = 2;
end;
for i=501:1000
y(i) = -5;
end;
plot(y)
 

Similar threads

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