4 views (last 30 days)

Show older comments

Hi all

thank you for helping

i want to draw figure in matlab that has two main effect (temprature and effiency ) in Y axis in sides when X axis is same range

for example

x=[11 22 33 44 55];

y1E=[0.5506 0.5925 0.6212 0.6419 0.6573]; %Effeiceny 1

y1T=[43.7529 45.0284 45.9019 46.5297 46.9987]; %Temprature 1

when i use this

Ax=plotyy(x,y1E,x,y1T);

hy1=get(Ax(1),'ylabel');

hy2=get(Ax(2),'ylabel');

set(hy1,'string',' efficiency 1');

set(hy2,'string','Temperature1');

xlabel('Number ');

it gives me figure with 1x axis and 2 Y axis in both side

i want to add another Effeiceny and Temprature with same X and in same figure

y2E=[0.3 0.4 0.6 0.8 0.3]; %Effeiceny 2

y2T=[50 45 43 47 55]; %Temprature 2

how can i do that

thank you for this helping

ANKUR KUMAR
on 15 Mar 2021

clc

clear

t=linspace(0,pi,100);

sinplot=sin(t);

cosplot=cos(t);

tanplot=tan(t);

linecolors={'r' [0 .5 0] 'b'};

h3i=plotNy(t,sinplot,1,t,cosplot,2,t,tanplot,3,...

'Linewidth',1,'YAxisLabels',{'' '' ''},'XAxisLabel','Deg',...

'LineColor',linecolors,...

'FontSize',12,...

'Fontname','TimesNewRoman',...

'Grid','on',...

'LegendString',{'Sin' 'Cos' 'Tan'});

for i=1:length(h3i.ax)

set(h3i.ax(i),'ycolor',linecolors{i});

end

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

Start Hunting!