plotting data
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
0 commentaires
Réponse acceptée
Image Analyst
le 12 Mai 2012
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 commentaires
Image Analyst
le 12 Mai 2012
See your duplicate question at http://www.mathworks.com/matlabcentral/answers/38194-linear-regression
Plus de réponses (1)
lowcalorie
le 12 Mai 2012
1 commentaire
Image Analyst
le 12 Mai 2012
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.
Voir également
Catégories
En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!