Clear Filters
Clear Filters

Info

This question is closed. Reopen it to edit or answer.

problem regarding limits of y and x-axis

1 view (last 30 days)
Rai
Rai on 10 May 2019
Closed: MATLAB Answer Bot on 20 Aug 2021
Hello,
I am having problems regarding the limits of x and yy axis in csv file. I have share the code, csv file and required graph which plot in the matlab please help where is
problem in the code why the graph is not look like this.
fast.PNG
[plotData,S] = xlsread('nosfast.csv');
figure
[Ax,H1,H2] = plotyy(plotData(:,3),plotData(:,4), plotData(:,1),plotData(:,2));
hold on
grid minor
plot(plotData(:,5),plotData(:,6))
hold off
H1.LineStyle = '-';
H2.LineStyle = '-';
hold off
ylabel(Ax(1), 'Voltage(V)')
ylabel(Ax(2), 'Current(nA)');
% title('ESD event under negative HBM')
legend('Idd, M0', 'V1', 'V2') % Create Legend
ytr = get(Ax(2), 'YTick'); % Get Default Right Y-Yick Values
newytr = linspace(min(ytr), max(ytr), 11); % Create New Right Y-Tick Values
newytrl = linspace(0, 1000, numel(newytr)); % Create New Right Y-Tick Labels
set(Ax(2), 'YTick',newytr, 'YTickLabel',newytrl); % Set New Right Y-Tick Labels
ytl = get(Ax(1), 'YTick'); % Get Default Left Y-Yick Values
newytl = linspace(min(ytl), max(ytl), 12); % Create New Left Y-Tick Values
newytll = round(newytl,1); % Create New Left Y-Tick Labels
set(Ax(1), 'YTick',newytl, 'YTickLabel',newytll); % Set New Left Y-Tick Labels
xt = get(gca, 'XTick');
set(gca, 'XTick',xt, 'XTickLabel',xt*1E+6)
xlabel('Time(us)')
  2 Comments
Bob Thompson
Bob Thompson on 10 May 2019
'problem in the code why the graph is not look like this'
What exactly do you mean by this? Is the data wrong, is it just a matter of presentation, or is there something else I'm missing?
Rai
Rai on 10 May 2019
Thank you for answer
My cvs data is correct but after matlab plotting axis are not correct. This graph is different with the above desired graph. May be my code is not correct please help me. I hope you understand.fasttt.png

Answers (1)

Bob Thompson
Bob Thompson on 13 May 2019
It seems like all you need to do is change the axis range.
This can be done manually in the figure window. Open the 'Edit' menu and select 'Axes Properties...'
Alternatively, you can set the range with code using something like the following:
figure(1)
plot(x,y)
axis([0 1 0 1]) % Sets x and y-axes to range from 0 to 1

This question is closed.

Community Treasure Hunt

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

Start Hunting!