Plot a sound to get sine waves

4 ビュー (過去 30 日間)
Leif Olav Moen
Leif Olav Moen 2014 年 11 月 6 日
回答済み: Leif Olav Moen 2014 年 11 月 7 日
Hey, I have a project where I'm trying to plot a sound and show how you can see the sine waves in it. I try with
>> [y,fs]=wavread('C:\Users\Moen\Documents\MATLAB\Sine_wave_440.wav');
>> t=[1/fs:1/fs:length(y)/fs];
>> plot(t,y)
in MATLAB, but all i get in the plot is a blue square. What can I do to show sine waves in a sound?
Thanks!

採用された回答

Chad Greene
Chad Greene 2014 年 11 月 6 日
Can you upload the wave file? Without having the data it's hard to guess, but perhaps you're seeing too many sine waves squished into the window. If t is in seconds, two 440 Hz sine waves should be evident if you type
xlim([0 2/440])

その他の回答 (2 件)

Star Strider
Star Strider 2014 年 11 月 6 日
The blue square is actually the signal, but plotted so densely you can’t see any detail. (This is normal.) If you want to see the signal in more detail, use the axis function. In your situation, you might want to do something like this:
plot(t,y)
axis([0 100 ylim])
Change the ‘0’ and ‘100’ values as necessary to whatever lets you see the part of the signal you want. (You can also zoom in the figure window, depending on what you want to do, but that is likely not as useful as axis.)

Leif Olav Moen
Leif Olav Moen 2014 年 11 月 7 日
Thanks for the help! xlim([0 2/440]) worked.

カテゴリ

Help Center および File ExchangeAudio I/O and Waveform Generation についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by