How to give different colors to different regions of a signal(extracted from an audio amplitude-Fs)?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
i need to give different colors with an interval of 1 second
0 comentarios
Respuestas (1)
Mathieu NOE
el 23 de Nov. de 2021
hello
maybe this ?
clc
clearvars
% signal
Fs = 100;
dt= 1 /Fs;
samples = 5*Fs; % 5 seconds of signal
freq = 3;
t = (0:samples-1)*dt;
x = sin(2*pi*freq*t);
buffer_seconds = 1; % buffer length in seconds
buffer = buffer_seconds*Fs; % buffer length in samples
figure(1),hold on
for ci = 1:fix(samples/buffer)
start_index = 1+(ci-1)*buffer;
stop_index = min(start_index+ buffer,samples);
tt = t(start_index:stop_index); %
xx = x(start_index:stop_index); %
plot(tt,xx)
end
hold off
0 comentarios
Ver también
Categorías
Más información sobre Signal Processing Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!