MATLAB How do I create a simple straight line graph in MATLAB?

  • Thread starter Thread starter boreilly
  • Start date Start date
  • Tags Tags
    Graph Matlab
AI Thread Summary
To create a straight line graph in MATLAB, users can utilize the built-in plotting functions. First, input the voltage measurements and corresponding speed data into MATLAB. The 'plot' function can be used to create the initial graph. To add a best fit line, the 'polyfit' function is recommended, which calculates the slope and intercept of the linear fit. The 'polyval' function can then be used to evaluate the polynomial at specific points for plotting the best fit line. For further guidance, a helpful resource was shared, detailing linear curve fitting in MATLAB.
boreilly
Messages
8
Reaction score
0
i have done a simple experient and now i want to draw a graph in MATLAB. how do i do that? its a straight line graph so i'd like to be able to put on a best fit line and get the slope of that. As basic as this is I'm struggling to find help how to do it on the net.seems i can find a billion pages on graphing functions etc and big fancy 3d graphs. I have a list of voltage measurements and a corresponding speed for each one
 
Physics news on Phys.org
Check if this link helps
http://www.swarthmore.edu/NatSci/echeeve1/Ref/Matlab/CurveFit/LinearCurveFit.html
 
Last edited by a moderator:
perfect. exactly. thanks.
 

Similar threads

Replies
2
Views
3K
Replies
6
Views
2K
Replies
4
Views
2K
Replies
1
Views
2K
Replies
4
Views
3K
Replies
3
Views
4K
Back
Top