How can I plot two vectors using the plotyy command, and after that plot two points with different y-scales on the same graph?

  • Graphing:
I have three vectors, Ia (current), Va (voltage), Pa (power).
First I want to plot "Ia vs Va" and "Pa vs Va" on the same graph, given that Ia and Pa have two different y-scales. (Ia: ylim([ 0 10], Pa: ylim([0 300]))
This can be done using the plotyy command without any problems.
But then I would like to plot the ordered pairs (Va(mpp), Ia(mpp),'bo') and (Va(mpp), Pa(mpp), 'go') on the same graph. So how can I specify that I want to plot the first pair one according to the left y-axis scale and the second one to the right y-axis?
Thank you very much!
Eid

Respuestas (2)

You can continue to add axes with no color and whose 'layer' is 'bottom' in the same position as the two axes created by plotyy().
Whenever I've had to do this, I start by creating a simple plotyy plot and then breaking the axes down using get:
[ax,h1,h2] = plotyy(1:10,1:10,1:10,100:-10:1);
Then compare:
get(ax(1))
with
get(ax(2))
To figure out what settings are doing what.
[AX,H1,H2] = plotyy(Va,la,Va,Pa); %handles to the axes will be in AX
plot(AX(1),Va(mpp), Ia(mpp),'bo');
plot(AX(2),Va(mpp), Pa(mpp), 'go')

Categorías

Preguntada:

Eid
el 14 de Dic. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by