Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

[Matlab] Linearization

  1. Nov 30, 2006 #1

    this is my situation: I've got some data from an experiment stored in matlab. So I plot the graph and get a x^2 curve. I plot the loglog graph and see a near-"perfect" line. Now I want to create the best approximation to it (in a least squares sense).

    I don't want to do that manually as it's a tedious process. So I tried polyfit, but when I compare the line generated by polyfit to the line from the experiments + after applying loglogging it doesn't match at all.

    I take it I made something wrong, but I don't get what. :cry:
  2. jcsd
  3. Nov 30, 2006 #2
    Try polyfitting the log values of the data you obtained, instead of polyfitting the actual values and then plotting the log plot thereafter. If that doesn't work, then show the data you obtained and the Matlab code you used here. That helps in pinpointing where you go wrong.

    Btw, I think this thread is more relevant in the Homework section.
  4. Dec 1, 2006 #3
    Thanks for your reply I think it solved the problem.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook