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

Matlab Matlab Power Fit on Graph-Codes

  1. Apr 23, 2017 #1
    I have some data and I need power fit.And display it on the graph.But I couldnt find the right codes for it.(I need codes)
    Here my graph,

    Part A.png

    Here my codes,
    >> x=BN(:,2);
    >> B=BN(:,1);
    >> plot(x,B,'go')
    >> plot(x,B,'go')
    >> hold on
    >> xlabel('Distance (m)','Fontsize',21);
    >> ylabel('Magnetic Field Strength (T)','Fontsize',21)
    >> title('B vs x,Part (A)','Fontsize',23)
    >> grid on
    >>

    I tried ,
    >> f = fit(x,B,'power1')
    but says,
    Undefined function 'fit' for input arguments of type 'double'.

    Thanks
     
  2. jcsd
  3. Apr 23, 2017 #2

    Dr Transport

    User Avatar
    Science Advisor
    Gold Member

    do you have the curve fit toolbox?
     
  4. Apr 23, 2017 #3
    Nope sadly
     
  5. Apr 23, 2017 #4

    Dr Transport

    User Avatar
    Science Advisor
    Gold Member

    I think fit is a part of the toolbox and not part of matlab in general...
     
  6. Apr 23, 2017 #5
    Theres fit things but not power fit.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Matlab Power Fit on Graph-Codes
  1. Matlab codes (Replies: 2)

  2. Matlab code (Replies: 0)

  3. Matlab Code (Replies: 2)

Loading...