Skip to content

Instantly share code, notes, and snippets.

@FelipeCortez
Created March 8, 2017 00:41
Show Gist options
  • Save FelipeCortez/346cfffe16db3b32ea7a2eb32c72039c to your computer and use it in GitHub Desktop.
Save FelipeCortez/346cfffe16db3b32ea7a2eb32c72039c to your computer and use it in GitHub Desktop.
Mary had a little lamb
rate = 8000
freqs = [494 440 392 440 494 494 494]
x = 0:1/rate:3.5
y = zeros(x)
range = 1:4001
for i = 1:length(freqs)
y(range) = exp(-10 * x(range) + 5 * (i - 1)) .* sin(2 * %pi * freqs(i) * x(range))
range = range + 4000
end
clf()
plot2d3(x, y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment