clear
clc

Amplitude1=1;
Amplitude2=1;

WaveNumber1=10;
WaveNumber2=12;

SamplingRate=1000;

X=-10:1/SamplingRate:10;

Wave1=Amplitude1*sin(WaveNumber1.*X);
Wave2=Amplitude2*sin(WaveNumber2.*X);

figure(1);
subplot(3,1,1),plot(X,Wave1,X,Wave2);
title('Waves to Superimposed (WaveNumbers: k1=10, k2=12)');
ylabel('Amplitude');
grid on

SuperImposedWaves=Wave1+Wave2;

subplot(3,1,2),plot(X,SuperImposedWaves);
title('The Superimposed Waves');
ylabel('Amplitude');
grid on

FreqXAxis=0:SamplingRate./((length(SuperImposedWaves)-1)./(2*pi)):SamplingRate;
Spectrum=abs(fft(SuperImposedWaves,length(SuperImposedWaves))./SamplingRate);

subplot(3,1,3),plot(FreqXAxis(1:80),Spectrum(1:80),'r');
title('The Spectrum of the SuperImposed Waves');
xlabel('WaveNumber (k)');
ylabel('Magnitude');
grid on