0% found this document useful (0 votes)
7 views2 pages

Waveform Plots in MATLAB

This document contains MATLAB code that generates and plots different types of waves including sine, Gaussian, impulse, step, ramp, parabolic, sinc function, exponential, and triangle waves. The code uses stem plots within a subplot structure to display the different waves on the same set of axes for comparison.

Uploaded by

anishji
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)
7 views2 pages

Waveform Plots in MATLAB

This document contains MATLAB code that generates and plots different types of waves including sine, Gaussian, impulse, step, ramp, parabolic, sinc function, exponential, and triangle waves. The code uses stem plots within a subplot structure to display the different waves on the same set of axes for comparison.

Uploaded by

anishji
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

clc

close all
% x=-10:20;
% y=5*sin(x);
% subplot(3,1,1)
% stem(x,y)
% title('sine wave');
% xlabel('x-axis');
% ylabel('y-axis');
% grid on
% hold on
% y=5*exp(-(x.^2));
% subplot(3,1,2)
% stem(x,y)
% title('gausian wave');
% xlabel('x-axis');
% ylabel('y-axis');
% grid on
% hold on
% subplot(3,2,1)
% y=[zeros(1,10) 1 zeros(1,10)];
% stem(x,y)
% title('impulse wave');
% xlabel('x-axis');
% ylabel('y-axis');
% grid on
% hold on
% y=[zeros(1,10) ones(1,21)];
% stem(x,y);
% title('step wave');
% xlabel('x-axis');
% ylabel('y-axis');
% grid on
% hold on
% subplot(3,3,1)
% y=[zeros(1,11) 1:20];
% stem(x,y);
% title('ramp wave');
% xlabel('x-axis');
% ylabel('y-axis');
% grid on
% hold on
% a=0:0.05:10;
% u=[a.^2];
% y=[zeros(1,11) 1:20];
% stem(a,u);
% title('parabolic wave');
% xlabel('x-axis');
% ylabel('y-axis');
% grid on
% n=-5:0.1:5;
% u=sin(n)./n;
% stem(n,u);
% title('sinc function');
% xlabel('time');
% ylabel('amplitude');
% n=0:0.1:10;
% a=0.5;
% x=a.^n;
% stem(n,x);
% axis([0 10 0 1]);
% t=-10:0.1:10;
% a=0.5;
% x=exp(-a*t.^2);
% stem(t,x);
% n=-10:0.1:10;
% a=-2;
% x1=1-abs(n)/a;
% x2=0;
% x=x1.*(abs(n)<=a)+x2.*(abs(n)>a);
% stem(n,x)

You might also like