diff --git a/App/app.mlapp b/App/app.mlapp index ac57d04..de24041 100644 Binary files a/App/app.mlapp and b/App/app.mlapp differ diff --git a/src/NotWorking/generate_cosine.m b/src/Generators/generate_cosine.m similarity index 100% rename from src/NotWorking/generate_cosine.m rename to src/Generators/generate_cosine.m diff --git a/src/NotWorking/generate_heartbeat.m b/src/Generators/generate_heartbeat.m similarity index 100% rename from src/NotWorking/generate_heartbeat.m rename to src/Generators/generate_heartbeat.m diff --git a/src/NotWorking/generate_trapezoid.m b/src/Generators/generate_trapezoid.m similarity index 100% rename from src/NotWorking/generate_trapezoid.m rename to src/Generators/generate_trapezoid.m diff --git a/src/NotWorking/generate_pulse.m b/src/NotWorking/generate_pulse.m deleted file mode 100644 index 2f9c316..0000000 --- a/src/NotWorking/generate_pulse.m +++ /dev/null @@ -1,33 +0,0 @@ -function x = generate_pulse(amplitude, frequency, phase, fs, duration, duty) -% GENERATE_puse: returns a matrix of sampled pulse wave - -% CONTRIBUTORS: -% Brian Tran: Created the wave - -% DOCUMENTATION: -% phase shift is in number of periods -% fs is the sampling frequency: how many sample points per second -% duration is time in seconds -% duty is a number between 0 and 1 - - % initialize local variables from input arguments - n = fs * duration; % number of samples (length of matrix) - dt = 1 / fs; % sampling period: time between two sample points - % initialize a one dimensional zero matrix to be populated - x = zeros(1, n); - f0=1e+6; % 1MHz - Fs=3e+6; - Tf=0.001; % 1 millisecond - t=0:1/Fs:Tf-1/Fs; - td=0.1; % duty cycle - A0=10; % 10 Volts - F=0; - N=1000; % Number of points - - % populate the matrix - for n = 1:N - F=F+(1/n)*cos(n*2*pi*f0*t).*sin(n*pi*td); - end - F=F*(2*A0/pi); - F=F+A0*td; -end \ No newline at end of file diff --git a/src/Select/SoundGeneratorSelect.m b/src/Select/SoundGeneratorSelect.m index f99f4f2..b3355a8 100644 --- a/src/Select/SoundGeneratorSelect.m +++ b/src/Select/SoundGeneratorSelect.m @@ -20,6 +20,14 @@ function output = SoundGeneratorSelect(amplitude, frequency, phase, fs, duration output = generate_white(amplitude, fs, duration); elseif(number == "HalfCircle") output = generate_halfCircles(amplitude, frequency, phase, fs, duration, duty); + elseif(number == "Trapezoid") + output = generate_trapezoid(amplitude, frequency, phase, fs, duration, duty); + elseif(number == "Pulse") + output = generate_pulse(amplitude, frequency, phase, fs, duration, duty); + elseif(number == "Cosine") + output = generate_cosine(amplitude, frequency, phase, fs, duration, duty); + elseif(number == "Heartbeat") + output = generate_heartbeat(amplitude, frequency, phase, fs, duration, duty); else output = zeros(1, fs * duration); end