x-axis value

13 vues (au cours des 30 derniers jours)
Rai
Rai le 4 Mai 2019
Commenté : Rik le 7 Mai 2019
Hello,
I need help regarding x-axis values. I need that x-axis start at 1 ns and end at 20 ns. This is my code where i have to make changes plesase tell me.
plotData = importdata('nosnoise.csv')
plotData.colheaders(1)
plotData.data(1)
figure(1)
clf
hold on
grid minor
plot(plotData.data(:,1),plotData.data(:,2),'x-m')
plot(plotData.data(:,3),plotData.data(:,4),'x-m')
title('ESD event for the CDM')
x = linspace(0,20);
% set(gca,'FontSize',18);
xlabel('Time (ns)')
ylabel('Voltage (V)')
legend({'Immunity to power supply noise'})

Réponse acceptée

Rik
Rik le 4 Mai 2019
Modifié(e) : Rik le 4 Mai 2019
You x-axis exponent has me believe that you already have the correct range and that your goal is to show nanoseconds instead of seconds on your x-axis (note the 10^-8 at the end of your axis).
You can do this two ways: either change the data, or change the axis ticks. The first is easier, but I chose to do the second.
plotData = importdata('nosnoise.csv')
plotData.colheaders(1)
plotData.data(1)
figure(1)
clf
hold on
grid minor
plot(plotData.data(:,1),plotData.data(:,2),'x-m')
plot(plotData.data(:,3),plotData.data(:,4),'x-m')
title('ESD event for the CDM')
x=linspace(0,20,5);
set(gca,'XTick',x*10^-9)
set(gca,'XTickLabels',cellfun(@num2str,num2cell(x),'UniformOutput',0))
xlabel('Time (ns)')
ylabel('Voltage (V)')
legend({'Immunity to power supply noise'})
  4 commentaires
Rai
Rai le 5 Mai 2019
thank you for your help but I need more help regarding y axis how can i change there axis according to my limits. Pleae help me
Rik
Rik le 7 Mai 2019
What exactly is the problem you're having now?

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Line Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by