why this message error ?:Array indices must be positive integers or logical values
显示 更早的评论
Hi,
When i write this little script:
---------------------------------------------------------------------------------------------------------
demo matlab
t = (10:1:200)';
y = sin(2*pi*50*t)
z = y(t-10)
w = y+z
plot(t(1:50),w(1:50))
sound(w,Fs);
-------------------------------------------------------------------------------------------------------
there is a message error: message error: Array indices must be positive integers or logical values.
Howewer,when i write this:
-----------------------------------------------------------------------------------------------------
demo matlab
t = (0:0.001:100)';
y = sin(2*pi*50*t)
plot(t(1:50),y(1:50))
sound(y,Fs);
------------------------------------------------------------------------------------------------------
there is no message error.
Why?
thanks
采纳的回答
更多回答(2 个)
jérôme TAÏEB
2018-9-30
0 个投票
3 个评论
Image Analyst
2018-9-30
Who are you talking to? This should be a comment to someone , not an answer to your original question.
Try soundsc().
Star Strider
2018-9-30
The sound is there. It is of too short a duration to notice:
signal_duration = (200-11)/44000
signal_duration =
0.00429545454545455
It only lasts for 4.3 milli-seconds!
jérôme TAÏEB
2018-9-30
编辑:jérôme TAÏEB
2018-9-30
Image Analyst
2018-9-30
0 个投票
See attached sound making demo. It doesn't make your sound but adapt it as needed.

类别
在 帮助中心 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!