필터 지우기
필터 지우기

how to plot a graph

조회 수: 1 (최근 30일)
Elysi Cochin
Elysi Cochin 2013년 2월 12일
i have a matfile with x and y values as shown in the link below...
the x values are [1;2;3;4;5]..... for these x values and taking each column in the variable y, i want to plot a graph......
please can someone help me plot these 5 lines in one graph with each line in different color..... please do reply
i wanted the x-axis and y-axis markings to be as shown in the link below
please do reply....

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 2월 12일
편집: Azzi Abdelmalek 2013년 2월 12일
col='rgbkc'
hold on
for ii=1:5
line(x,y(:,ii),'color',col(ii),'Marker','o','LineStyle','--','markerfacecolor',col(ii),'Markersize',6)
end
legend({'curv1','curv2','curv3','curv4','curv5'},'location','SouthEast')
xlabel('x')
ylabel('y')
set(gca,'ylim',[0 max(y(:))])
hold off
  댓글 수: 1
Elysi Cochin
Elysi Cochin 2013년 2월 12일
thank u sir....

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

추가 답변 (1개)

Ahmed
Ahmed 2013년 2월 12일
if true
%
hold on
for i=2:1:5
plot(x,y(:,i),'b-+','LineWidth',1,'MarkerSize',5);
xlabel('x values');
ylabel('y values');
end
end
you may change the values of i according to thr columns you want to plot
ok?
  댓글 수: 1
Elysi Cochin
Elysi Cochin 2013년 2월 12일
how to give different colors for each line and how to give the x marking as 10, 20 ,30,....100..... and y marking as 1,1.5,2,2.5,3........5
please do reply.....

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

카테고리

Help CenterFile Exchange에서 Directed Graphs에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by