how do i change units of xaxis and yaxis without changing the plot??

207 views (last 30 days)
Hi. I have a capacitance per unit length Vs meters plot. How can I change x-axis units to micrometers and y-axis units to pico Farads per meter. I actually want to get rid of 10^-11 and write appropriate units in y-label

Answers (2)

Adam
Adam on 24 Sep 2018
If you are using a sufficiently new Matlab then you can use
hAxes.XAxis.Exponent = 0;
for an axes handle, hAxes, to get rid of the exponent.
If you want to change the x data of the plot you can either keep hold of the plot handle when you plot it and change the XData, e.g.
figure; h = plot( 1:10, rand(1,10 ) );
h.XData = h.XData * 100 % or h.XData = 1:10:100 or whatever
or you can change the tick labels using
hAxes.XTickLabel
though I wouldn't recommend that as it creates a disconnect between what is reported on your axes and what you see if you use the data cursor or other code that uses the domain of the graph.

Sultan alkhteeb
Sultan alkhteeb on 5 Sep 2019
it is very easy to get rid of 10^-11,,,
f = 0:df:fs-df; % this is your frequency
t = 0:dt:duration-dt; % and this is your time
t1=t/1e-9 % if you want to chage it to NANO sec .
f1=f*1e-6 % if you want to chage it to Mega Hz.
figure(1)
plot(t1, CH1(1:N));
xlabel('Time (ns)'); % if you want the time to be in Micro t1=t/1e-6 and so on ,,,,
plot(f1, CH2(1:N));
xlabel('Frequency (MHz)'); % f1=f*1e-6 ,, or f1=f*1e-3 for kHz

Categories

Find more on Programming in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!