Hello, I am new to Matlab.. I wanna to plot bar with 2 different y axis... I do not understand much functions, so can any one help me

댓글 수: 4

KALYAN ACHARJYA
KALYAN ACHARJYA 2018년 9월 11일
편집: KALYAN ACHARJYA 2018년 9월 11일
Which version Matlab you are using?
Ali Tawfik
Ali Tawfik 2018년 9월 11일
2016a
Ali Tawfik
Ali Tawfik 2018년 9월 11일
I really hope you can help me..
KALYAN ACHARJYA
KALYAN ACHARJYA 2018년 9월 11일
편집: KALYAN ACHARJYA 2018년 9월 11일
If somehow I can help you, it would be great for me. I am using quite older version of Matlab, yyaxis was introduced in 2016a,have you tried as following, I have not tested it.
x=linspace(0,20);
y1=sin(x);
yyaxis left
bar(x,y)
y2=sin(2*x).*exp(0.5*x);
yyaxis right
bar(x,z)

댓글을 달려면 로그인하십시오.

 채택된 답변

KALYAN ACHARJYA
KALYAN ACHARJYA 2018년 9월 11일
편집: KALYAN ACHARJYA 2018년 9월 12일

0 개 추천

Check here, it would be helpful.
With the help of same link, I have done this one. %Plot two signal y-axis with bar
x=0:.1:5;
y1=sin(x);
y2=cos(x);
figure,
[sig,sig1,sig2]=plotyy([1:length(y1)],y1,[1:length(y2)],y2,'bar','bar');
set(sig1,'FaceColor','r') ;
set(sig2,'FaceColor','b') ;
title('Two y axis Plot');
xlabel('Time')
ylabel(sig(1),'Sin') % left y-axis
ylabel(sig(2),'Cos') % right y-axis
Hope it would be helpful.

댓글 수: 4

Ali Tawfik
Ali Tawfik 2018년 9월 11일
@KalYan.. Thanks for your prompt answer. I am trying with both codes, but unfortunately as I am new so I do not understand much the code written... I wanna x= value and y= value.. so that I can do..So hope you can clarify better
Ali Tawfik
Ali Tawfik 2018년 9월 11일
For example, I do not understand the first three lines of the code.. how can I implement just numbers ... But this exactly what I wanna do sth like taht
KALYAN ACHARJYA
KALYAN ACHARJYA 2018년 9월 11일
편집: KALYAN ACHARJYA 2018년 9월 11일
Ali Tawfik, Can you share the code, which do you want to implement this?
KALYAN ACHARJYA
KALYAN ACHARJYA 2018년 9월 11일
편집: KALYAN ACHARJYA 2018년 9월 12일
I have edited the answer, now you can modify the code as per your requirements.
For any Help, mention in comment below.
Thanks

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

질문:

2018년 9월 11일

편집:

2018년 9월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by