You are on page 1of 13

1) The resultant vector of two harmonics having the same amplitudes and

frequencies.

code:
dt=0.0001
t=0:0.0001:0.5;
A1=10;
A2=10;
f1=20;
f2=20;
x1=A1*sin(f1*2*pi*t);
x2=A2*sin(f2*2*pi*t);
r1=x1+x2;
subplot(2,1,1);
plot(t,x1,'--r',t,x2,'--m',t,r1,'k');
grid on;
xlabel('Time (sec)');
ylabel('Displacement');
title('Original and resultant signal in time domain');

fs=1/dt;
N=length(t);
f=(0:N-1)*(fs/N);
xf=abs(fft(r1))*(2/N);
subplot(2,1,2);
plot(f,xf);
grid on;
xlabel('Frequancy (HZ)');
ylabel('Amplitude');
title('Resultant signal in frequancy domain');
axis([0 10*max([f1 f2]) 0 1.1*max([xf])])

___________________________________________________________________________

2) The resultant vector of two harmonics having different amplitudes and same
frequencies.

code:
dt=0.0001
t=0:0.0001:0.5;
A1=10;
A2=30;
f1=20;
f2=20;
x1=A1*sin(f1*2*pi*t);
x2=A2*sin(f2*2*pi*t);
r1=A1*sin(f1*2*pi*t)+A2*cos(f2*2*pi*t);
subplot(2,1,1);
plot(t,x1,'--r',t,x2,'--m',t,r1,'k');
grid on;
xlabel('Time (sec)');
ylabel('Displacement');
title('Original and resultant signal in time domain');

fs=1/dt;
N=length(t);
f=(0:N-1)*(fs/N);
xf=abs(fft(r1))*(2/N);
subplot(2,1,2);
plot(f,xf);
grid on;
xlabel('Frequancy (HZ)');
ylabel('Amplitude');
title('Resultant signal in frequancy domain');
axis([0 10*max([f1 f2]) 0 1.1*max([xf])])

___________________________________________________________________________

3) The resultant vector of two harmonics having same amplitudes and the first
frequency is very close to the second frequency (⍵𝟏≈⍵𝟐).

code
dt=0.0001
t=0:0.0001:1.6;
A1=10;
A2=10;
f1=15;
f2=15.5;
x1=A1*sin(f1*2*pi*t);
x2=A2*sin(f2*2*pi*t);
r1=A1*sin(f1*2*pi*t)+A2*cos(f2*2*pi*t);
subplot(2,1,1);
plot(t,x1,'--r',t,x2,'--m',t,r1,'k');
grid on;
xlabel('Time (sec)');
ylabel('Displacement');
title('Original and resultant signal in time domain');

fs=1/dt;
N=length(t);
f=(0:N-1)*(fs/N);
xf=abs(fft(r1))*(2/N);
subplot(2,1,2);
plot(f,xf);
grid on;
xlabel('Frequancy (HZ)');
ylabel('Amplitude');
title('Resultant signal in frequancy domain');
axis([0 10*max([f1 f2]) 0 1.1*max([xf])])

___________________________________________________________________________

4) The resultant vector of two harmonics having different amplitudes and the
first frequency is very close to the second frequency (⍵𝟏≈⍵𝟐).
code:
dt=0.0001
t=0:0.0001:1.4;
A1=10;
A2=20;
f1=15;
f2=15.5;
x1=A1*sin(f1*2*pi*t);
x2=A2*sin(f2*2*pi*t);
r1=A1*sin(f1*2*pi*t)+A2*cos(f2*2*pi*t);
subplot(2,1,1);
plot(t,x1,'--r',t,x2,'--m',t,r1,'k');
grid on;
xlabel('Time (sec)');
ylabel('Displacement');
title('Original and resultant signal in time domain');

fs=1/dt;
N=length(t);
f=(0:N-1)*(fs/N);
xf=abs(fft(r1))*(2/N);
subplot(2,1,2);
plot(f,xf);
grid on;
xlabel('Frequancy (HZ)');
ylabel('Amplitude');
title('Resultant signal in frequancy domain');
axis([0 10*max([f1 f2]) 0 1.1*max([xf])])

___________________________________________________________________________
5) The resultant vector of two harmonics having same amplitudes and different
frequencies (⍵𝟏≫⍵𝟐).

code:
dt=0.001
t=0:0.001:0.25;
A1=10;
A2=10;
f1=100;
f2=10;
x1=A1*sin(f1*2*pi*t);
x2=A2*sin(f2*2*pi*t);
r1=A1*sin(f1*2*pi*t)+A2*cos(f2*2*pi*t);
subplot(2,1,1);
plot(t,x1,'--r',t,x2,'--m',t,r1,'k');
grid on;
xlabel('Time (sec)');
ylabel('Displacement');
title('Original and resultant signal in time domain');

fs=1/dt;
N=length(t);
f=(0:N-1)*(fs/N);
xf=abs(fft(r1))*(2/N);
subplot(2,1,2);
plot(f,xf);
grid on;
xlabel('Frequancy (HZ)');
ylabel('Amplitude');
title('Resultant signal in frequancy domain');
axis([0 10*max([f1 f2]) 0 1.1*max([xf])])
6) The resultant vector of two harmonics having different amplitudes and
different frequencies (⍵𝟏≫⍵𝟐).

code:
dt=0.001
t=0:0.001:0.2;
A1=30;
A2=10;
f1=100;
f2=10;
x1=A1*sin(f1*2*pi*t);
x2=A2*sin(f2*2*pi*t);
r1=A1*sin(f1*2*pi*t)+A2*cos(f2*2*pi*t);
subplot(2,1,1);
plot(t,x1,'--r',t,x2,'--m',t,r1,'k');
grid on;
xlabel('Time (sec)');
ylabel('Displacement');
title('Original and resultant signal in time domain');

fs=1/dt;
N=length(t);
f=(0:N-1)*(fs/N);
xf=abs(fft(r1))*(2/N);
subplot(2,1,2);
plot(f,xf);
grid on;
xlabel('Frequancy (HZ)');
ylabel('Amplitude');
title('Resultant signal in frequancy domain');
axis([0 10*max([f1 f2]) 0 1.1*max([xf])])

___________________________________________________________________________

7) The resultant vector of 10 harmonics with same amplitudes and different


frequencies as follows: (⍵𝟏=𝟏𝟎,⍵𝟐=𝟐𝟎,⍵𝟑=𝟑𝟎,…….⍵𝟏𝟎=𝟏𝟎𝟎) 𝒓𝒂𝒅/𝒔𝒆𝒄.

code:
dt=0.0001
t=0:0.0001:0.5;
A1=10;
A2=10;
A3=10;
A4=10;
A5=10;
A6=10;
A7=10;
A8=10;
A9=10;
A10=10;
f1=10;
f2=20;
f3=30;
f4=40;
f5=50;
f6=60;
f7=70;
f8=80;
f9=90;
f10=100;
x1=A1*sin(f1*2*pi*t);
x2=A2*sin(f2*2*pi*t);
x3=A3*sin(f3*2*pi*t);
x4=A4*sin(f4*2*pi*t);
x5=A5*sin(f5*2*pi*t);
x6=A6*sin(f6*2*pi*t);
x7=A7*sin(f7*2*pi*t);
x8=A8*sin(f8*2*pi*t);
x9=A9*sin(f9*2*pi*t);
x10=A10*sin(f10*2*pi*t);

r1=x1+x2+x3+x4+x5+x6+x7+x8+x9+x10
subplot(2,1,1);
plot(t,x1,'--r',t,x2,'--m',t,x3,'--r',t,x4,'--m',t,x5,'--r',t,x6,'--
m',t,x7,'--r',t,x8,'--m',t,x9,'--r',t,x10,'--m',t,r1,'k');
grid on;
xlabel('Time (sec)');
ylabel('Displacement');
title('Original and resultant signal in time domain');

fs=1/dt;
N=length(t);
f=(0:N-1)*(fs/N);
xf1=abs(fft(r1))*(2/N);
subplot(2,1,2);
plot(f,xf1);
grid on;
xlabel('Frequancy (HZ)');
ylabel('Amplitude');
title('Resultant signal in frequancy domain');
axis([0 1*max([f1 f2 f3 f4 f5 f6 f7 f8 f9 f10]) 0 1.1*max([xf1])])
8) The resultant vector of 10 harmonics with different amplitudes and different
frequencies as follows: (⍵𝟏=𝟏𝟎,⍵𝟐=𝟐𝟎,⍵𝟑=𝟑𝟎,…….⍵𝟏𝟎=𝟏𝟎𝟎) 𝒓𝒂𝒅/𝒔𝒆𝒄.

code:
dt=0.0001
t=0:0.0001:0.5;
A1=10;
A2=20;
A3=30;
A4=40;
A5=50;
A6=60;
A7=70;
A8=80;
A9=90;
A10=100;
f1=10;
f2=20;
f3=30;
f4=40;
f5=50;
f6=60;
f7=70;
f8=80;
f9=90;
f10=100;
x1=A1*sin(f1*2*pi*t);
x2=A2*sin(f2*2*pi*t);
x3=A3*sin(f3*2*pi*t);
x4=A4*sin(f4*2*pi*t);
x5=A5*sin(f5*2*pi*t);
x6=A6*sin(f6*2*pi*t);
x7=A7*sin(f7*2*pi*t);
x8=A8*sin(f8*2*pi*t);
x9=A9*sin(f9*2*pi*t);
x10=A10*sin(f10*2*pi*t);

r1=x1+x2+x3+x4+x5+x6+x7+x8+x9+x10
subplot(2,1,1);
plot(t,x1,'--r',t,x2,'--m',t,x3,'--r',t,x4,'--m',t,x5,'--r',t,x6,'--
m',t,x7,'--r',t,x8,'--m',t,x9,'--r',t,x10,'--m',t,r1,'k');
grid on;
xlabel('Time (sec)');
ylabel('Displacement');
title('Original and resultant signal in time domain');

fs=1/dt;
N=length(t);
f=(0:N-1)*(fs/N);
xf1=abs(fft(r1))*(2/N);

subplot(2,1,2);
plot(f,xf1);
grid on;
xlabel('Frequancy (HZ)');
ylabel('Amplitude');
title('Resultant signal in frequancy domain');
axis([0 11*max([f1]) 0 1.1*max([xf1])])
9) The resultant vector of 10 harmonics with different amplitudes and different
frequencies randomly.

code:
dt=0.00001
t=0:0.00001:1;
A1=10;
A2=30;
A3=80;
A4=20;
A5=90;
A6=20;
A7=70;
A8=40;
A9=100;
A10=50;
f1=100;
f2=50;
f3=80;
f4=20;
f5=70;
f6=40;
f7=10;
f8=90;
f9=60;
f10=30;
x1=A1*sin(f1*2*pi*t);
x2=A2*sin(f2*2*pi*t);
x3=A3*sin(f3*2*pi*t);
x4=A4*sin(f4*2*pi*t);
x5=A5*sin(f5*2*pi*t);
x6=A6*sin(f6*2*pi*t);
x7=A7*sin(f7*2*pi*t);
x8=A8*sin(f8*2*pi*t);
x9=A9*sin(f9*2*pi*t);
x10=A10*sin(f10*2*pi*t);

r1=x1+x2+x3+x4+x5+x6+x7+x8+x9+x10
subplot(2,1,1);
plot(t,x1,'--r',t,x2,'--m',t,x3,'--r',t,x4,'--m',t,x5,'--r',t,x6,'--
m',t,x7,'--r',t,x8,'--m',t,x9,'--r',t,x10,'--m',t,r1,'k');
grid on;
xlabel('Time (sec)');
ylabel('Displacement');
title('Original and resultant signal in time domain');

fs=1/dt;
N=length(t);
f=(0:N-1)*(fs/N);
xf1=abs(fft(r1))*(2/N);

subplot(2,1,2);
plot(f,xf1);
grid on;
xlabel('Frequancy (HZ)');
ylabel('Amplitude');
title('Resultant signal in frequancy domain');
axis([0 1*max([f1]) 0 1.1*max([xf1])])

You might also like