%Math 316 - Spring 2017
%Written by M. Motamed @ UNM 
%========================================================
%Wave solution families
%========================================================
clear all; clc

L=1;
x=linspace(0,L,10000);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Two wave families
f1=2*sin(3*pi*x/L);    %family 1
f2=1*sin(30*pi*x/L);   %family 2
y= f1+f2;              %a general solution is obtained by combining f1&f2
figure; hold on
plot(x,f1,'b')
plot(x,f2,'r')
plot(x,y,'k','linewidth',2)
axis([0 L -3 3])

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Three wave families

f1=2*sin(3*pi*x/L);    %family 1
f2=1*sin(30*pi*x/L);   %family 2
f3=.5*sin(150*pi*x/L); %family 3
y= f1+f2+f3;          %a general solution is obtained by combining f1&f2&f3

figure; hold on
plot(x,f1,'b')
plot(x,f2,'r')
plot(x,f3,'c')
plot(x,y,'k','linewidth',2)
axis([0 L -3.5 3.5])
