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

18 ビュー (過去 30 日間)
suraz srimaruthi
suraz srimaruthi 2018 年 9 月 24 日
回答済み: Sultan alkhteeb 2019 年 9 月 5 日
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

回答 (2 件)

Adam
Adam 2018 年 9 月 24 日
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 2019 年 9 月 5 日
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

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by