**# Signals & Systems Lab 1

Index

  1. Introduction
    1. What is MATLAB
    2. Why MATLAB
  2. Basic MATLAB Commands
    1. clc
    2. clear all
    3. Variable Assignment
    4. Subplot
    5. Plot
    6. Labels and Titles
  3. Signals
    1. Exponential Signal
    2. Unit Step
    3. Unit Ramp
  4. References

Introduction

What is MATLAB

MATLAB is a high-level programming language and interactive environment used for numerical computation, visualization, and programming. It is widely used in academia and industry for various applications, including signal processing, image processing, control systems, and more.

Why MATLAB

MATLAB is chosen for its powerful computational capabilities, extensive libraries, and ease of use for matrix operations, plotting, and algorithm development. It supports various toolboxes that extend its functionality to specific domains.

Basic MATLAB Commands

clc

The clc command in MATLAB is used to clear the Command Window, removing all previous outputs and providing a clean workspace for new commands.

clear all

The clear all command removes all variables, functions, and MEX-files from the workspace, freeing up system memory.

Variable Assignment

In MATLAB, variables are assigned using the equals sign (=). For example, x = 5 assigns the value 5 to the variable x.

subplot

The subplot function is used to create a grid of subplots within a single figure. The syntax subplot(m, n, p) divides the figure into an m-by-n grid and places the plot in the p-th position.

plot

The plot function is used to create two-dimensional line plots. For example, plot(t, x) plots the variable x against t.

Labels and Titles

xlabel

The xlabel('text') function sets the label for the x-axis of the plot.

ylabel

The ylabel('text') function sets the label for the y-axis of the plot.

title

The title('text') function sets the title of the plot.

Signals

Exponential Signal

An exponential signal in MATLAB can be generated using the exp function. For example, x = exp(t) creates an exponential signal.

Unit Step

A unit step signal can be created using the heaviside function. For example, x = heaviside(t) creates a unit step signal.

Unit Ramp

A unit ramp signal can be generated by defining it piecewise. For example, x = t .* (t >= 0) creates a unit ramp signal.

clc;
clear all;
close all;
t=[-1:01:10];
n=length(t);
u=[];
								for i=1:n
	if(t(i)<0)
		u(i)=0;
	else:

References


	
Information
  • Date: 2024.07.26
  • Time: 12:35**