plotting data

조회 수: 2 (최근 30일)
lowcalorie
lowcalorie 2012년 5월 12일
i have a table of data
X = 1,2,3,4,5,6,7,8,9
Y= 4 5 6 9 8 7 4 1 2
how can i plot this data on a graph

채택된 답변

Image Analyst
Image Analyst 2012년 5월 12일
Um, did you look up "plot" in the help? Did you find anything like this:
plot(X, Y);
Or even fancier:
% Define sample data.
X = [1,2,3,4,5,6,7,8,9];
Y = [4 5 6 9 8 7 4 1 2];
% Do the plotting:
plot(X, Y, 'bo-', 'LineWidth', 3, 'MarkerSize', 15);
grid on;
% Maximize the figure window.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
% Label the various parts of the plot.
fontSize = 20;
title('lowcalorie Plot', 'FontSize', fontSize);
xlabel('X', 'FontSize', fontSize);
ylabel('Y', 'FontSize', fontSize);
  댓글 수: 3
lowcalorie
lowcalorie 2012년 5월 12일
How can i plot just points then plot a best fit line?
Image Analyst
Image Analyst 2012년 5월 12일
See your duplicate question at http://www.mathworks.com/matlabcentral/answers/38194-linear-regression

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

추가 답변 (1개)

lowcalorie
lowcalorie 2012년 5월 12일
yes but it is not working
  댓글 수: 1
Image Analyst
Image Analyst 2012년 5월 12일
Worked for me. I can't tell you why it didn't work unless I see your code. Did you put your data inside square brackets like I did? Also, you should add a comment to my answer, not post your comment as a new "Answer" to your question.

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by