Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
swastik1308 authored May 17, 2020
0 parents commit 0a60f01
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions task_2.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
ec=5;
fc=3000;
fs=8000;
fdev=10;
t = (0:1/fs:0.2);
x=input('Type S and press enter to start recording', 's');
if x== 'S';
voice = audiorecorder;
disp('Recording started');
recordblocking(voice, 10);
disp('Recording stopped');
o = getaudiodata(voice);
filename = 'reordedAudio.wav';
audiowrite(filename,o,fs);
clear o fs
[o,fs]=audioread(filename);
subplot(4,1,1);
plot(o);
title('Original Signal');
c=ec*2*pi*fc*t;
subplot(4,1,2);
plot(c);
title('Carrier Signal');
m=fmmod(o, fc, fs, fdev);
subplot(4,1,3);
plot(m);
title('Modulated Signal');
d=fmdemod(m,fc,fs,fdev);
subplot(4,1,4);
plot(d);
title('Demodulated Signal');
pause(5);
sound(d);
else
disp('You did not press the correct key')
end

0 comments on commit 0a60f01

Please sign in to comment.