plotting a piece-wise(multivalued_fu​nction) in matlab

This is short code to plot a piecewise function in matlab.. you can get the idea of creating the intervals for different time-steps.

You are now following this Submission

clc
clear all
n = -5:0.5:5
xn =(1+n/3).*(-3<=n & n<=-1)+(0<=n&n<=3)+ 0.*(n)
stem(n,xn)
axis([-10 10 0 2])
xlabel('n)
ylabel('x(n)')
title('(1+n/3).*(-3<=n & n<=-1)+(0<=n&n<=3)+ 0.*(n)')

Cite As

Aqeel Ahmed (2026). plotting a piece-wise(multivalued_function) in matlab (https://se.mathworks.com/matlabcentral/fileexchange/75337-plotting-a-piece-wise-multivalued_function-in-matlab), MATLAB Central File Exchange. Retrieved .

Tags

Add Tags

Add the first tag.

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.0.0