Appreciate helping me with this lab assignment.
1 view (last 30 days)
Show older comments
6 Comments
Walter Roberson
on 15 Jun 2020
for t = 0:time-1
xn=wrectT*cos(2*pi*f*t);
end
Every iteration of that loop, you overwrite all of xn .
for t = 0:time-1
xn(t+1) = wrectT*cos(2*pi*f*t);
end
Your code also needs to take into account sampling frequency. You need to sample at least twice as fast as your highest frequency note.
time=500;%half a second(0:500msec)
That implies you are thinking in terms of sampling once per millisecond, However, millisecond is only 1000 Hz and your last major cord is at 523.251130601197 Hz, so your sampling frequency needs to be above 1047 Hz.
Answers (0)
See Also
Categories
Find more on Audio and Video Data in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!