CVS yy-axis plot
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
I have attached the simulation result and csv file but I want to plot these graphs in matlab after plotting the graps in matlab my Y-axis is missing. This is my code I need help please where i went wrong.
plotData = importdata('nmosesd.csv')
plotData.colheaders(1)
plotData.data(1)
figure(1)
clf
hold on
grid minor
hLine(1)=plot(plotData.data(:,1),plotData.data(:,2),'*-r','LineWidth',2)
hLine(2)=plot(plotData.data(:,3),plotData.data(:,4),'p-b','LineWidth',2)
hLine(3)=plot(plotData.data(:,5),plotData.data(:,6),'o-k','LineWidth',2)
hLine(4)=plot(plotData.data(:,7),plotData.data(:,8),'^-g','LineWidth',2)
title('Output Voltage at 10K\Omega')
set(gca,'FontSize',11);
xlabel('Time','FontSize',11,'FontWeight','bold')
ylabel('Voltage','FontSize',11,'FontWeight','bold')
legend([hLine(1) hLine(2) hLine(3) hLine(4)],'Input Power for Low Vth transistor','Current','Input Power for High Vth transistor', 'Input Power for Standard Vth transistor')
0 commentaires
Réponse acceptée
Star Strider
le 2 Mai 2019
Try this:
plotData = importdata('nmosesd.csv')
plotData.colheaders(1)
plotData.data(1)
figure(1)
clf
hold on
grid minor
hLine(1)=plot(plotData.data(:,1),plotData.data(:,2),'*-r','LineWidth',2)
hLine(2)=plot(plotData.data(:,3),plotData.data(:,4),'p-b','LineWidth',2)
hLine(3)=plot(plotData.data(:,5),plotData.data(:,6),'o-k','LineWidth',2)
hLine(4)=plot(plotData.data(:,7),plotData.data(:,8),'^-g','LineWidth',2)
hold off
yyaxis right % Add Right Y-Axis
yt = get(gca, 'YTick'); % Get Default Y-Yick Values
newyt = linspace(min(yt), max(yt), 12); % Create New Right Y-Tick Values
newytl = linspace(-100, 1000, numel(newyt)); % Create New Right Y-Tick Labels
set(gca, 'YTick',newyt, 'YTickLabel',newytl); % Set New Right Y-Tick Labels
title('Output Voltage at 10K\Omega')
set(gca,'FontSize',11);
xlabel('Time','FontSize',11,'FontWeight','bold')
ylabel('Voltage','FontSize',11,'FontWeight','bold')
I do not have your data to work with. This works on my test plot.
13 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Axis Labels 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!