Adjust signal to plot

1 view (last 30 days)
Reeki
Reeki on 14 Feb 2014
Answered: Image Analyst on 14 Feb 2014
Hi!
I'm making a GUI with some axes and I want to adjust the signal to the full space of the axes. Here's an example:
As you can see, in the first Axe the signal is shown in just half of the space I created, and I want both, the signal plot and the pitch (Axes 2) adjusted to the full space.
this is my code:
[sample,fs]=wavread(name);
axes(handles.axes1);
dt = 1/fs;
time = 0:dt:(length(sample)*dt)-dt;
plot(time,sample);
axes(handles.axes2);
[F0, T, C] = spPitchTrackCepstrum(sample, fs, 30, 20, 'hamming');
plot(T,F0);
axes(handles.axes3);
specgram(sample, 1024, fs);colormap(jet);colorbar;xlabel(''); ylabel('');
Thanks!

Answers (1)

Image Analyst
Image Analyst on 14 Feb 2014
Figure out where the last element is and use xlim. Let's say the last element is length(sample). Then do
xlim([1, length(sample)]);
Do that after each call to plot().

Community Treasure Hunt

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

Start Hunting!