Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8571277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:44:48+00:00 2026-06-11T18:44:48+00:00

I have a simple loglog curve as above. Is there some function in Matlab

  • 0

enter image description here

I have a simple loglog curve as above. Is there some function in Matlab which can fit this curve by segmented lines and show the starting and end points of these line segments ? I have checked the curve fitting toolbox in matlab. They seems to do curve fitting by either one line or some functions. I do not want to curve fitting by one line only.

If there is no direct function, any alternative to achieve the same goal is fine with me. My goal is to fit the curve by segmented lines and get locations of the end points of these segments .

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T18:44:49+00:00Added an answer on June 11, 2026 at 6:44 pm

    First of all, your problem is not called curve fitting. Curve fitting is when you have data, and you find the best function that describes it, in some sense. You, on the other hand, want to create a piecewise linear approximation of your function.

    I suggest the following strategy:

    1. Split manually into sections. The section size should depend on the derivative, large derivative -> small section
    2. Sample the function at the nodes between the sections
    3. Find a linear interpolation that passes through the points mentioned above.

    Here is an example of a code that does that. You can see that the red line (interpolation) is very close to the original function, despite the small amount of sections. This happens due to the adaptive section size.

    enter image description here

    function fitLogLog()
       x = 2:1000;
       y = log(log(x));
    
       %# Find section sizes, by using an inverse of the approximation of the derivative
       numOfSections = 20;
       indexes = round(linspace(1,numel(y),numOfSections));
       derivativeApprox = diff(y(indexes));
       inverseDerivative = 1./derivativeApprox;
       weightOfSection =  inverseDerivative/sum(inverseDerivative);   
       totalRange = max(x(:))-min(x(:));   
       sectionSize = weightOfSection.* totalRange;
    
       %# The relevant nodes
       xNodes = x(1) + [ 0 cumsum(sectionSize)];
       yNodes = log(log(xNodes));
    
       figure;plot(x,y);   
       hold on;
       plot (xNodes,yNodes,'r');
       scatter (xNodes,yNodes,'r');
       legend('log(log(x))','adaptive linear interpolation');
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have simple example: function File(name) { this.name = name this.text = null }
I have simple class with width and height member fields which define number of
I have a simple recursive function to write in VBA that does the following
i have simple side menu with this html code : <div id=menu> <div> Menu
I have simple node js http server. var http = require(http); http.createServer(function(request, response) {
I have this simple code that records appends a log to a text file:
Have simple C# console app which imports text data into SQL. It takes around
I have simple WCF Service Application (based on this tutorial : Getting Started ).
I have simple WebView code like this: WebView wv = (WebView) findViewById(R.id.webview1); wv.loadUrl(http://en.wikipedia.org/wiki/Book); But
I have simple XML which I would like to query for mnemonic collection. <?xml

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.