For Switch Case Case Break Otherwise End End
For Switch Case Case Break Otherwise End End
addchannel(ai, 1);
ai.SampleRate = 8000;
ai.SamplesPerTrigger = 40000;
ai.TriggerType = 'Immediate';
start(ai)
[d,t] = getdata(ai);
figure(1)
plot(t,d);
xlabel('time');
ylabel('Amplitude')
title('recoded sound')
for i=1:100
op = input('enter 1 for listen sound or press 2 to proceed');
switch(op)
case 1
sound(d);
case 2
break;
otherwise
disp('you enter the wrong option, try again.');
end
end
time = t';
f = 3000;
w = 2*pi*f;
c = sin(w*time);
figure(2)
plot(time,c);
xlabel('time');
ylabel('Amplitude')
title('carrier')
figure(3)
m = d'.*c;
plot(time,m);
xlabel('time');
ylabel('Amplitude')
title('modulated signal')
figure(4)
plot(time,d',time,m)
xlabel('time');
ylabel('Amplitude')
title('modulated signal and data signal')
ai = analoginput('winsound');
addchannel(ai, 1);
ai.SampleRate = 8000;
ai.SamplesPerTrigger = 40000;
ai.TriggerType = 'Immediate';
start(ai)
[d,t] = getdata(ai);
figure(1)
plot(t,d);
xlabel('time');
ylabel('Amplitude')
title('recoded sound')
for i=1:100
op = input('enter 1 for listen sound or press 2 to proceed');
switch(op)
case 1
sound(d);
case 2
break;
otherwise
disp('you enter the wrong option, try again.');
end
end
time = t';
f = 3000;
w = 2*pi*f;
c = sin(w*time);
figure(2)
plot(time,c);
xlabel('time');
ylabel('Amplitude')
title('carrier')
figure(3)
m = d'.*c;
plot(time,m);
xlabel('time');
ylabel('Amplitude')
title('modulated signal')
figure(4)
plot(time,d',time,m)
xlabel('time');
ylabel('Amplitude')
title('modulated signal and data signal')