Info

此问题已关闭。 请重新打开它进行编辑或回答。

problem regarding limits of y and x-axis

1 次查看(过去 30 天)
Rai
Rai 2019-5-10
关闭: MATLAB Answer Bot 2021-8-20
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 个评论
Bob Thompson
Bob Thompson 2019-5-10
'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 2019-5-10
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

回答(1 个)

Bob Thompson
Bob Thompson 2019-5-13
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

此问题已关闭。

Community Treasure Hunt

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

Start Hunting!

Translated by