Matlab code:
clc; % Clear all input and output
clear all; % Clear all variables and objects in the matlab work-space
close all; % Close all figures.
b=[1 1 1 1 1]; % 2nd input
c=a+b; % Element by Addition
d=a-b; % Element by Subtraction
e=a./b; % Element by Division
f=a.*b; % Element by Multiplication
subplot(3,3,1); % Divides the current figure into rectangular panes
stem(a); % Stem plots discrete sequence data
title('1st input');
xlabel('Index->');
ylabel('Magnitude');
subplot(3,3,2);
stem(b);
title('2nd input'); % Insert Title in the figure window
xlabel('Index->'); % Labels the x-axis
ylabel('Magnitude'); % Labels the y-axis
subplot(3,3,3);
stem(c);
title('Addition');xlabel('Index->');ylabel('Magnitude');
subplot(3,3,4);
stem(d);
title('Subtraction');xlabel('Index->');ylabel('Magnitude');
subplot(3,3,5);
stem(e);
title('Division');xlabel('Index->');ylabel('Magnitude');
subplot(3,3,6);
stem(f);
No comments:
Post a Comment