Lines of best fit in matlab?
-
Lines of best fit in matlab? So I am new to Matlab and I'm doing a lab where I have six curves and I need to plot the line of best fit (least squares fit) of each. I don't need to use the whole curve but only the portion that goes from x=.1 to x=.5. I need to show these six lines on the same graph, using only said portion of the curves. I tried to go to Tools>Basic fitting from my figure window, then choose "linear" and Save to workspace as a variable (I did this for all six curves so now I have six fit variables), but I don't know how to actually plot them on a figure since plot(fit1); doesn't make sense. I also tried: plot(polyfit(x variable, y variable,1)) but the line that comes up doesn't seem right (has a negative slope) and I can't plot more than 1 on the same graph. Can anyone help me? Thanks a bunch.
-
Answer:
You can use 'polyfit' to get a fit, and 'polyvalue' to interpolate values. Then you can plot whatever you need. These are some examples: http://www.matrixlab-examples.com/polynomials.html http://www.matrixlab-examples.com/interpolation.html
GeorgeCl... at Yahoo! Answers Visit the source
Related Q & A:
- What Are The Best Android Applications For Samsung Galaxy Fit?Best solution by samsung.com
- How to draw this fractal using MATLAB?Best solution by Stack Overflow
- How to delete temporary files in MATLAB?Best solution by Stack Overflow
- What is the best way to count lines in file?Best solution by Stack Overflow
- What are the best ski goggles to fit over your glasses?Best solution by ebay.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.