change appearing values one X- axis only

7 visualizaciones (últimos 30 días)
Dam
Dam el 15 de Ag. de 2012
Hi to all; when plotting in matlab, matlab is automatically giving the values on the X axis form 0 to 300 depending on the number (size) of data I plot (Y size); i want to change these values appearing on the X axis; let us say i want values from 100 to 200 to appear on the X axis ; How can i do so ?
Thank you for ur answer
regards

Respuesta aceptada

Image Analyst
Image Analyst el 16 de Ag. de 2012
Editada: Image Analyst el 16 de Ag. de 2012
You mean like
xlim([100 200]);
That will set up the "viewport" of your plot. Maybe you're plotting stuff from 0 to 1000 but only points with x values of 100-200 will be seen in your plot and points outside there will be not visible.
Or do you want to keep the x data but just reassign the x tick labels? Let's say you have 300 time points as your x, and voltage as your y. But let's say that element 1 was at time 100 milliseconds, and element 300 represents 200 milliseconds. Well you can continue to plot all 300 data points and just stick new labels onto the tick marks. Following the example from the help:
set(gca,'XTickLabel',{'100 ms';'150 ms';'200 ms'});
to relabel 3 tick marks.

Más respuestas (1)

Azzi Abdelmalek
Azzi Abdelmalek el 15 de Ag. de 2012
Editada: Azzi Abdelmalek el 15 de Ag. de 2012
it seems that you are using
plot(y)
%example
y=sin(0:0.1:10);
plot(y); % x axis are from 1 to length(y)
% if i want it from 100 to 200
x=linspace(100,200,length(y))
figure;plot(x,y)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by