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

Matlab Codes

The document contains MATLAB code that generates and plots various sequences including unit impulse, unit step, unit ramp, sine and cosine sequences. It also contains code to plot exponential sequences with different values of a and normalized Gaussian and random distributions.

Uploaded by

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

Matlab Codes

The document contains MATLAB code that generates and plots various sequences including unit impulse, unit step, unit ramp, sine and cosine sequences. It also contains code to plot exponential sequences with different values of a and normalized Gaussian and random distributions.

Uploaded by

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

clc; xlabel('n');

clear all;
close all; %cos
subplot(3,3,5);
n=-5:1:10; stem(n,f)
for i=-5:1:10 title('Cosine sequence');
u=i+6; ylabel('Amplitude');
if (i==0) xlabel('n');
d(u)=1;
else
d(u)=0;
end
if (i<0)
st(u)=0;
rmp(u)=0;
else
st(u)=1;
rmp(u)=i;
end
e(u)=sin(i);
f(u)=cos(i);
end

%unit impulse
subplot(3,3,1)
stem(n,d)
title('Unit Impulse sequence');
ylabel('Amplitude');
xlabel('n');

%unit step
subplot(3,3,2);
stem(n,st);
title('Unit Step sequence');
ylabel('Amplitude');
xlabel('n');

%unit ramp
subplot(3,3,3);
stem(n,rmp)
title('Ramp sequence');
ylabel('Amplitude');

xlabel('n');

%sine
subplot(3,3,4);
stem(n,e)
title('Sine sequence');
ylabel('Amplitude');
clc; xlabel('n');
clear all; ylabel('Amplitude');
close all; subplot(2,2,2);
n=-10:1:10; stem(n,b1);
a=0.5; title('a=0.5 ; -1<=a<=0');
b=-0.5; xlabel('n');
c=-2; ylabel('Amplitude')
d=2; subplot(2,2,3);
for i=-10:1:10 stem(n,c1);
u=i+11; title('a=2 ; a>=1');
a1(u)=power(a,i); xlabel('n');
b1(u)=power(b,i); ylabel('Amplitude')
c1(u)=power(c,i); subplot(2,2,4);
d1(u)=power(d,i); stem(n,d1);
end title('a=-2 ; a<=-1');
subplot(2,2,1); xlabel('n');
stem(n,a1); ylabel('Amplitude')
title('a=0.5 ; 0<=a<=1');

clc;
clear all;
close all;
lb=-10;
ub=10;
step=1;
n=lb:step:ub;
s=2.*n.*((0.8).^n);
d=randi([1,10],[1,21]);
x=s+d;
p=downsample(x,2);
subplot(4,2,1);stem(n,s);
subplot(4,2,2);stem(n,d);
subplot(4,2,3);stem(n,x);
subplot(4,2,4);stem(p);
clc;
clear all;
close all;
lb=1;
ub=50;
step=1;
mean=20;
var=40;
n=lb:step:ub;
pi=3.14;
e=2.72;
for i=lb:step:ub
a(i)=(1./sqrt(2.*pi.*var));
b(i)=(-((i-mean).^2))/(2.*var);
c(i)=e.^b(i);
gauss(i)=a(i).*c(i);
end
rand=normrnd(mean,sqrt(var),1,50);
pdf=normpdf(n,mean,sqrt(var));
% stem(n,a);
subplot(3,1,1);stem(n,gauss);
subplot(3,1,2);stem(n,rand);
subplot(3,1,3);stem(n,pdf);

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy