user50222
user50222

Reputation: 119

How to set x axis values in MATLAB

I'm working with some signal. The signal has some length (time) and I devided it into 200 pieces and made some operations over them. The results are saved in matrix, so the matrix has one of the dimensions 200 and if I use imagesc() on it, to make results visualy readable, the x axis is from 0 to 200. But that does not correspond to time. The time is function of the values in x axis.

t = 640 * x

I need to make values in x axis to correspond to time. Is there any way, how to do this?

Upvotes: 0

Views: 525

Answers (1)

rayryeng
rayryeng

Reputation: 104464

Use set and set the XTick and the XTickLabel properties accordingly. Assuming your image is already open, do this:

set(gca, 'XTick', 0:20:200);
set(gca, 'XTickLabel', 640*(0:20:200));

I used increments of 20 so that you don't clutter the x-axis. Modify the 20 to suit your tastes.

Upvotes: 1

Related Questions