0% found this document useful (0 votes)
13 views3 pages

Experiment 2 1

Important questions

Uploaded by

mannammanikanta7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views3 pages

Experiment 2 1

Important questions

Uploaded by

mannammanikanta7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Experiement-2

MATLAB program to apply different operations on signals


( Addition ,Subtraction, Multiplication & Division)

AIM: Signal Addition, Subtraction, Multiplication, and Division using MATLAB

EQUIPMENTS:
Operating System – Windows XP
Constructor - Simulator
Software - MATLAB 2012a

Theory
 Signals Definition:

 x1(t)=sin(2πft) -------..A sine wave.


 x2(t)=cos(2πft)…….: A cosine wave.

Operations:

 Addition: y(t)=x1(t)+x2(t)
 Subtraction: y(t)=x1(t)−x2(t)
 Multiplication: y(t)=x1(t)⋅x2(t)
 Division: y(t)=x1(t)/x2(t)

Program:
clc;
clear;
close all;
% Define the time vector
t = -10:0.01:10;
% Define two example signals
x1 = sin(2*pi*0.1*t); % Signal 1: Sine wave
x2 = cos(2*pi*0.1*t); % Signal 2: Cosine wave
% Perform operations
signal_addition = x1 + x2; % Addition
signal_subtraction = x1 - x2; % Subtraction
signal_multiplication = x1 .* x2; % Multiplication (pointwise)
signal_division = x1 ./ (x2 + 1e-6); % Division (avoid division by zero)
% Plot the signals and results
figure;
% Plot Signal 1
subplot(3,2,1);
plot(t, x1, 'b', 'LineWidth', 1.5);
title('Signal 1 (x1)');
xlabel('Time');
ylabel('Amplitude');
grid on;
% Plot Signal 2
subplot(3,2,2);
plot(t, x2, 'r', 'LineWidth', 1.5);
title('Signal 2 (x2)');
xlabel('Time');
ylabel('Amplitude');
grid on;
% Plot Signal Addition
subplot(3,2,3);
plot(t, signal_addition, 'g', 'LineWidth', 1.5);
title('Signal Addition (x1 + x2)');
xlabel('Time');
ylabel('Amplitude');
grid on;
% Plot Signal Subtraction
subplot(3,2,4);
plot(t, signal_subtraction, 'm', 'LineWidth', 1.5);
title('Signal Subtraction (x1 - x2)');
xlabel('Time');
ylabel('Amplitude');
grid on;
% Plot Signal Multiplication
subplot(3,2,5);
plot(t, signal_multiplication, 'k', 'LineWidth', 1.5);
title('Signal Multiplication (x1 .* x2)');
xlabel('Time');
ylabel('Amplitude');
grid on;
% Plot Signal Division
subplot(3,2,6);
plot(t, signal_division, 'c', 'LineWidth', 1.5);
title('Signal Division (x1 ./ x2)'); xlabel('Time');
ylabel('Amplitude');
grid on;
disp('Program executed successfully.');

PROCEDURE:
1. Open the Mat lab software by clicking on icon.
2. Create a new file (filenew.m file).
3. Now type the program in that file.
4. Save the program as .m file(filesave)
5. Run the program(debugrun)
6. Observe the output plots.

RESULT: Analog and Discrete time signals are observed and results are plotted using MATLAB

You might also like