Why does the figure show black image only in Matlab?

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

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

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.