使用时间值更改波形图的颜色
Change Color of Waveform Plot Using Time Values
我目前正在做一个语音处理项目,有一个关于西班牙语 (aire) 单词的时间波形的快速问题。
我想突出显示包含音素 ai 的波形部分。使用 Audacity,我已经能够及时标记音素出现的位置,并且想知道我如何才能改变波形那部分的颜色。
有人告诉我在 MatLab 中使用 hold on
函数,但我不确定应该传入哪些参数,或者是否有更简单的方法来完成此操作。
谢谢
使用hold on
的简单解决方案:
% something to plot:
x = 1:1000;
y = sin(linspace(-pi,pi,1000)*10).^3;
% the region of interest:
ai_start = find(x>200);
ai_end = find(x>400);
% plotting:
plot(x(1:ai_start-1),y(1:ai_start-1)); % first part
hold on
plot(x(ai_start:ai_end),y(ai_start:ai_end),'r')% the ai region
plot(x(ai_end+1:end),y(ai_end+1:end),'Color',lines(1))% end part
hold off
我目前正在做一个语音处理项目,有一个关于西班牙语 (aire) 单词的时间波形的快速问题。
我想突出显示包含音素 ai 的波形部分。使用 Audacity,我已经能够及时标记音素出现的位置,并且想知道我如何才能改变波形那部分的颜色。
有人告诉我在 MatLab 中使用 hold on
函数,但我不确定应该传入哪些参数,或者是否有更简单的方法来完成此操作。
谢谢
使用hold on
的简单解决方案:
% something to plot:
x = 1:1000;
y = sin(linspace(-pi,pi,1000)*10).^3;
% the region of interest:
ai_start = find(x>200);
ai_end = find(x>400);
% plotting:
plot(x(1:ai_start-1),y(1:ai_start-1)); % first part
hold on
plot(x(ai_start:ai_end),y(ai_start:ai_end),'r')% the ai region
plot(x(ai_end+1:end),y(ai_end+1:end),'Color',lines(1))% end part
hold off