Professional Documents
Culture Documents
Group Member:
1. Omkar Bhilare 191060901
2. Omkar Sargar 181060047
3. Om Fuke 181060046
4. Lukesh Ankamwar 181060038
Code:-
clc;
clear all;
time_start=input('Enter start time: ');
time_end=input('Enter end time: ');
time_c=time_start:0.001:time_end;
time_d=time_start:1:time_end;
switch m
case 1
if n==1
A=input('Enter the Amplification or
Scaling factor:');
p_x = A*sine(time_c);
%p= A*sine(comp*(time_c-d));
p_y=fliplr(p_x);
p_o = (p_x-p_y)*0.5;
p_e = (p_x+p_y)*0.5;
subplot(3,1,1)
plot(time_c , p_x , 'r'); grid on;
title('Sine Signal');
xlabel('time');
ylabel('Amplitude')
subplot(3,1,2)
plot(time_c,p_o,'r');grid on;
title('Odd Signal');
xlabel('time');
ylabel('Amplitude');
subplot(3,1,3)
plot(time_c,p_e,'r');grid on;
title('Even Signal');
xlabel('time');
ylabel('Amplitude');
elseif n==2
A=input('Enter the Amplification or Scaling
factor:');
p_x = A*sine(time_d);
%p= A*sine(comp*(time_c-d));
p_y=fliplr(p_x);
p_o = (p_x-p_y)*0.5;
p_e = (p_x+p_y)*0.5;
subplot(3,1,1)
stem(time_d , p_x ,'r'); grid on;
title('Sine Signal');
xlabel('time');
ylabel('Amplitude')
subplot(3,1,2)
stem(time_d,p_o,'r');grid on;
title('Odd Signal');
xlabel('time');
ylabel('Amplitude');
subplot(3,1,3)
stem(time_d,p_e,'r');grid on;
title('Even Signal');
xlabel('time');
ylabel('Amplitude');
end
case 2
if n==1
A=input('Enter the Amplification or Scaling
factor:');
p_x = A*cosine(time_c);
%p= A*sine(comp*(time_c-d));
p_y=fliplr(p_x);
p_o = (p_x-p_y)*0.5;
p_e = (p_x+p_y)*0.5;
subplot(3,1,1)
plot(time_c , p_x,'r'); grid on;
title('Sine Signal');
xlabel('time');
ylabel('Amplitude')
subplot(3,1,2)
plot(time_c,p_o,'r');grid on;
title('Odd Signal');
xlabel('time');
ylabel('Amplitude');
subplot(3,1,3)
plot(time_c,p_e,'r');grid on;
title('Even Signal');
xlabel('time');
ylabel('Amplitude');
elseif n==2
A=input('Enter the Amplification or Scaling
factor:');
p_x = A*cosine(time_d);
%p= A*sine(comp*(time_c-d));
p_y=fliplr(p_x);
p_o = (p_x-p_y)*0.5;
p_e = (p_x+p_y)*0.5;
subplot(3,1,1)
stem(time_d , p_x,'r'); grid on;
title('Cosine Signal');
xlabel('time');
ylabel('Amplitude')
subplot(3,1,2)
stem(time_d,p_o,'r');grid on;
title('Odd Signal');
xlabel('time');
ylabel('Amplitude');
subplot(3,1,3)
stem(time_d,p_e,'r');grid on;
title('Even Signal');
xlabel('time');
ylabel('Amplitude');
end
case 3
if n==1
A=input('Enter the Amplification or Scaling
factor:');
p_x = A*Unit_Step(time_c);
p_y=fliplr(p_x);
p_o = (p_x-p_y)*0.5;
p_e = (p_x+p_y)*0.5;
subplot(3,1,1)
plot(time_c , p_x , 'r'); grid on;
title('Unit Step Signal');
xlabel('time');
ylabel('Amplitude')
subplot(3,1,2)
plot(time_c,p_o ,'r');grid on;
title('Odd Signal');
xlabel('time');
ylabel('Amplitude');
subplot(3,1,3)
plot(time_c,p_e ,'r');grid on;
title('Even Signal');
xlabel('time');
ylabel('Amplitude');
elseif n==2
A=input('Enter the Amplification or Scaling
factor:');
p_x = A*Unit_Step(time_d);
p_y=fliplr(p_x);
p_o = (p_x-p_y)*0.5;
p_e = (p_x+p_y)*0.5;
subplot(3,1,1)
stem(time_d , p_x,'r'); grid on;
title('Unit Step Signal');
xlabel('time');
ylabel('Amplitude')
subplot(3,1,2)
stem(time_d,p_o,'r');grid on;
title('Odd Signal');
xlabel('time');
ylabel('Amplitude');
subplot(3,1,3)
stem(time_d,p_e,'r');grid on;
title('Even Signal');
xlabel('time');
ylabel('Amplitude');
end
case 4
if n==1
A=input('Enter the Amplification or Scaling
factor:');
p_x = A*Ramp(time_c);
p_y=fliplr(p_x);
p_o = (p_x-p_y)*0.5;
p_e = (p_x+p_y)*0.5;
subplot(3,1,1)
plot(time_c , p_x,'r'); grid on;
title('Ramp Signal');
xlabel('time');
ylabel('Amplitude')
subplot(3,1,2)
plot(time_c,p_o,'r');grid on;
title('Odd Signal');
xlabel('time');
ylabel('Amplitude');
subplot(3,1,3)
plot(time_c,p_e,'r');grid on;
title('Even Signal');
xlabel('time');
ylabel('Amplitude');
elseif n==2
A=input('Enter the Amplification or Scaling
factor:');
p_x = A*Ramp(time_d);
p_y=fliplr(p_x);
p_o = (p_x-p_y)*0.5;
p_e = (p_x+p_y)*0.5;
subplot(3,1,1)
stem(time_d , p_x,'r'); grid on;
title('Sine Signal');
xlabel('time');
ylabel('Amplitude')
subplot(3,1,2)
stem(time_d,p_o,'r');grid on;
title('Odd Signal');
xlabel('time');
ylabel('Amplitude');
subplot(3,1,3)
stem(time_d,p_e,'r');grid on;
title('Even Signal');
xlabel('time');
ylabel('Amplitude');
end
case 5
if n==1
A=input('Enter the Amplification or Scaling
factor:');
p_x = A*exponential(time_c);
p_y=fliplr(p_x);
p_o = (p_x-p_y)*0.5;
p_e = (p_x+p_y)*0.5;
subplot(3,1,1)
plot(time_c , p_x,'r'); grid on;
title('Exponential Signal');
xlabel('time');
ylabel('Amplitude')
subplot(3,1,2)
plot(time_c,p_o,'r');grid on;
title('Odd Signal');
xlabel('time');
ylabel('Amplitude');
subplot(3,1,3)
plot(time_c,p_e,'r');grid on;
title('Even Signal');
xlabel('time');
ylabel('Amplitude');
elseif n==2
A=input('Enter the Amplification or Scaling
factor:');
p_x = A*exponential(time_d);
%p= A*sine(comp*(time_c-d));
p_y=fliplr(p_x);
p_o = (p_x-p_y)*0.5;
p_e = (p_x+p_y)*0.5;
subplot(3,1,1)
stem(time_d , p_x,'r'); grid on;
title('Exponential Signal');
xlabel('time');
ylabel('Amplitude')
subplot(3,1,2)
stem(time_d,p_o,'r');grid on;
title('Odd Signal');
xlabel('time');
ylabel('Amplitude');
subplot(3,1,3)
stem(time_d,p_e,'r');grid on;
title('Even Signal');
xlabel('time');
ylabel('Amplitude');
end
case 6
if n==1
p_x = Custom1(time_c);
p_y=fliplr(p_x);
p_o = (p_x-p_y)*0.5;
p_e = (p_x+p_y)*0.5;
subplot(3,1,1)
plot(time_c , p_x,'r'); grid on;
title('Custom Signal');
xlabel('time');
ylabel('Amplitude')
subplot(3,1,2)
plot(time_c,p_o,'r');grid on;
title('Odd Signal');
xlabel('time');
ylabel('Amplitude');
subplot(3,1,3)
plot(time_c,p_e,'r');grid on;
title('Even Signal');
xlabel('time');
ylabel('Amplitude');
elseif n==2
p_x = Custom1(time_d);
%p= A*sine(comp*(time_c-d));
p_y=fliplr(p_x);
p_o = (p_x-p_y)*0.5;
p_e = (p_x+p_y)*0.5;
subplot(3,1,1)
stem(time_d , p_x,'r'); grid on;
title('Custom Signal');
xlabel('time');
ylabel('Amplitude')
subplot(3,1,2)
stem(time_d,p_o,'r');grid on;
title('Odd Signal');
xlabel('time');
ylabel('Amplitude');
subplot(3,1,3)
stem(time_d,p_e,'r');grid on;
title('Even Signal');
xlabel('time');
ylabel('Amplitude');
end
case 7
if n==1
p_x = Custom2(time_c);
p_y=fliplr(p_x);
p_o = (p_x-p_y)*0.5;
p_e = (p_x+p_y)*0.5;
subplot(3,1,1)
plot(time_c , p_x,'r'); grid on;
title('Custom Signal');
xlabel('time');
ylabel('Amplitude')
subplot(3,1,2)
plot(time_c,p_o,'r');grid on;
title('Odd Signal');
xlabel('time');
ylabel('Amplitude');
subplot(3,1,3)
plot(time_c,p_e,'r');grid on;
title('Even Signal');
xlabel('time');
ylabel('Amplitude');
elseif n==2
p_x = Custom2(time_d);
%p= A*sine(comp*(time_c-d));
p_y=fliplr(p_x);
p_o = (p_x-p_y)*0.5;
p_e = (p_x+p_y)*0.5;
subplot(3,1,1)
stem(time_d , p_x,'r'); grid on;
title('Custom Signal');
xlabel('time');
ylabel('Amplitude')
subplot(3,1,2)
stem(time_d,p_o,'r');grid on;
title('Odd Signal');
xlabel('time');
ylabel('Amplitude');
subplot(3,1,3)
stem(time_d,p_e,'r');grid on;
title('Even Signal');
xlabel('time');
ylabel('Amplitude');
end
case 8
if n==1
z=input('Enter Signal:');
subplot(3,1,1)
title('User Customized Signal');
xlabel('time');
ylabel('Amplitude');
plot(time_c,z);grid on;
y = fliplr(z)
subplot(3,1,2)
plot(time_c ,y); grid on;
p_e = (z + y)*0.5;
p_o = (z -y) * 0.5;
subplot(3,1,2)
plot(time_c ,p_e); grid on;
title('Even Signal');
xlabel('time');
ylabel('Amplitude');
subplot(3,1,3)
plot(time_c ,p_o); grid on;
title('Odd Signal');
xlabel('time');
ylabel('Amplitude');
elseif n==2
z=input('Enter Signal:');
subplot(3,1,1)
title('User Customized Signal');
xlabel('time');
ylabel('Amplitude');
stem(time_d,z);grid on;
y = fliplr(z)
subplot(3,1,2)
stem(time_d ,y); grid on;
p_e = (z + y)*0.5;
p_o = (z -y) * 0.5;
subplot(3,1,2)
plot(time_c ,p_e); grid on;
title('Even Signal');
xlabel('time');
ylabel('Amplitude');
subplot(3,1,3)
stem(time_d ,p_o); grid on;
title('Odd Signal');
xlabel('time');
ylabel('Amplitude');
end
otherwise
fprintf('Invalid input');
end
end
Theoretical Analysis:
Even Component
Odd Component