Você está na página 1de 12

%amplitude shift keying

t=0:0.001:1;
f1=2;
sq=square(2*pi*f1*t);
subplot(3,1,1);
plot(t,sq);
xlabel('frequency');
ylabel('amplitude');
title('square signal');
f2=4;
si=sin(2*pi*f2*t);
subplot(3,1,2);
plot(t,si);
xlabel('frequency');
ylabel('amplitude');
title('sine signal');
z=length(sq);
for i=1:z
if(sq(i)==1)
r(i)=si(i);
else
r(i)=0;
end
end
subplot(3,1,3);
plot(t,r);
xlabel('frequency');
ylabel('amplitude');
title('ask signal');

%frequncy shift keying


t=0:0.001:1;
f1=2;
sq=square(2*pi*f1*t);
subplot(4,1,1);
plot(t,sq);
xlabel('frequency');
ylabel('amplitude');
title('square signal');
f2=10;
si1=sin(2*pi*f2*t);
subplot(4,1,2);
plot(t,si1);
xlabel('frequency');
ylabel('amplitude');
title('sine signal');
f3=40;
si2=sin(2*pi*f3*t);
subplot(4,1,3);
plot(t,si2);
xlabel('frequency');
ylabel('amplitude');
title('sine signal');
z=length(sq);
for i=1:z
if(sq(i)==1)
r(i)=si1(i);
else
r(i)=si2(i);
end
end
subplot(4,1,4);
plot(t,r);
xlabel('frequency');
ylabel('amplitude');
title('fsk signal');

TecAnz

%phase shift keying


t=0:0.001:1;
f1=2;
sq=square(2*pi*f1*t);
subplot(3,1,1);
plot(t,sq);
xlabel('frequency');
ylabel('amplitude');
title('square signal');
f2=8;
si=sin(2*pi*f2*t);
subplot(3,1,2);
plot(t,si);
xlabel('frequency');
ylabel('amplitude');
title('sine signal');
z=length(sq);
for i=1:z
if(sq(i)==1)
r(i)=si(i);
else
r(i)=-si(i);
end
end
subplot(3,1,3);
plot(t,r);
xlabel('frequency');
ylabel('amplitude');
title('psk signal');

%half wave rectifier


t=0:0.001:1;
f=2;
si=sin(2*pi*f*t);
subplot(2,1,1);
plot(t,si);
xlabel('frequency');
ylabel('amplitude');
title('sine wave');
z=length(si);
for i=1:z
if(si(i)>0)
r(i)=si(i);
else
r(i)=0;
end
end
subplot(2,1,2);
plot(t,r);
xlabel('frequency');
ylabel('amplitude');
title('half wave rectified sig');

TecAnz

%double clipper
t=0:0.001:1;
f=2;
si=sin(2*pi*f*t);
subplot(2,1,1);
plot(t,si);
xlabel('frequency');
ylabel('amplitude');
title('sine signal');
z=length(si);
for i=1:z
if(si(i)>.4)
r(i)=.4;
elseif(si(i)<-.3)
r(i)=-.3;
else
r(i)=si(i);
end
end
subplot(2,1,2);
plot(t,r);
xlabel('frequency');
ylabel('amplitude');
title('double clipped signal');

%wave form generator


t=0:0.001:1;
f=2;
si=sin(2*pi*f*t);
z=length(si);
for i=1:z
if(si(i)>.8)
r(i)=.8;
elseif(si(i)<-.4)
r(i)=-.4;
else
r(i)=si(i);
end
end
for i=1:z
if(si(i)<0)
r(i)=-r(i);
end
end
subplot(1,1,1);
plot(t,r);
xlabel('frequency');
ylabel('amplitude');
title('double clipped signal');
------------------------------%transpose of a matrix
a=input('enter the elements of matrix');
disp('matrix befor operation:'),a
b=a';
disp('after operation:'),b

TecAnz

%full wave rectifier


t=0:0.001:1;
f=2;
si=sin(2*pi*f*t);
subplot(2,1,1);
plot(t,si);
xlabel('frequency');
ylabel('amplitude');
title('sine wave');
z=length(si);
for i=1:z
if(si(i)>0)
r(i)=si(i);
else
r(i)=-si(i);

%sawtooth
t=0:0.0001:2;
y=t;
z=length(y);
for i=1:z
if(y(i)<1)
r(i)=y(i);
else
r(i)=y(i)-1;
end
end
subplot(1,1,1);
plot(t,r);
xlabel('frequency');
ylabel('amplitude');
title('sawtooth signal');

end
end
subplot(2,1,2);
plot(t,r);
xlabel('frequency');
ylabel('amplitude');
title('half wave rectified sig');

TecAnz

%rounding of no.
a=input('enter the no=','s'); %inputing no
si=numel(a); %to estimate the no.of digits
for i=1:si %to find the location of deci point
if(a(i)=='.') %chk for dec point
l=i; %found location
end
end
n=a(l+1); %first no. after decimel point
if(a(l+2)>'5')
n=n+1;
end
for i=1:si %re construction of rounded no.
b(i)=a(i);
if(a(i)=='.')
b(i+1)=n;
break
end
end
disp('no after operation:'),b

%sampling
t=0:0.001:1;
f=2;
si=sin(2*pi*f*t);
subplot(3,1,1);
plot(t,si);
xlabel('frequency');
ylabel('amplitude');
title('modulating signal');
fs=input('sampling frequency:');
ts=1/fs;
tx=0:ts:1;
ss=sin(2*pi*f*tx);
subplot(3,1,2);
stem(tx,ss);
xlabel('frequency');
ylabel('amplitude');
title('sampled signal');
subplot(3,1,3);
plot(tx,ss);
xlabel('frequency');
ylabel('amplitude');
title('reccovered signal');

TecAnz

%matrix multiplication
o1=input('enter the order of first matrix');%colum
seperated by ';'
o2=input('enter the order of seconf matrix');
if(o1(2)==o2(1))
disp('order of mul matrix is'),o1(1),o2(2)
A =input('enter the elements of first matrix');
B =input('enter the elements of second matrix')
C = A * B;%
disp('the multiplied out is'),C
else
disp('mat.multiplication not possible');
end

%triangular
t=0:0.0001:2;
y=t;
z=length(y);
for i=1:z
if(y(i)<1)
r(i)=y(i);
else
r(i)=2-y(i);
end
end
subplot(1,1,1);
plot(t,r);
xlabel('frequency');
ylabel('amplitude');
title('tring signal');

TecAnz

%sawtooth
t=0:0.0001:2;
y=t;
z=length(y);
for i=1:z
if(y(i)<1)
r(i)=y(i);
else
r(i)=y(i)-1;
end
end
subplot(1,1,1);
plot(t,r);
xlabel('frequency');
ylabel('amplitude');
title('sawtooth signal');

%clamping
t=0:0.001:1;
f=2;
si=sin(2*pi*f*t);
subplot(2,1,1);
plot(t,si);
xlabel('frequency');
ylabel('amplitude');
title('sine signal');
r=si+3;
subplot(2,1,2);
plot(t,r);
xlabel('frequency');
ylabel('amplitude');
title('clamped signal');

TecAnz

Ask

fsk

TecAnz

Psk

clamping
TecAnz

Doubl clipper

hwr
TecAnz

Positive clipper

TecAnz

sampling

Sawtooth sig

Double clipper
TecAnz

Você também pode gostar