Re: [Scilab-users] Multiple regression on semi-log plot

2020-11-16 Thread Stéphane Mottelet
Hi, It is possible to fit a more general piecewise-affine model, but you will have to know in advance the number of "kinks" S. Le 16/11/2020 à 09:49, arctica1963 a écrit : Hello, Thanks for showing how it works, always good to get a proper understanding. Just wondering if the code can be

Re: [Scilab-users] Multiple regression on semi-log plot

2020-11-16 Thread arctica1963
Hello, Thanks for showing how it works, always good to get a proper understanding. Just wondering if the code can be adapted to find multiple straight line segments? Looking at my original test data, it appears to have "kinks" at wavenumber (0.05, 0.12 and 0.16), the last one is where the x

Re: [Scilab-users] Multiple regression on semi-log plot

2020-11-15 Thread stephane . mottelet
Hello, You just have to replace "x" by "wavelength" and "y" by "ln_power". The slopes are the first two component of the optimal vector "popt" : clearclf()// Read data - wavelength (in km)), power, 1 standard deviation// Unknown data length; 3 columns -default space delimited //

Re: [Scilab-users] Multiple regression on semi-log plot

2020-11-14 Thread arctica1963
Hello, Thanks for the idea and suggestions. Not too sure how to apply it, if you could give some pointers on the attached data and code. The ultimate idea is to get the slopes of the straight line segments. Many thanks, Lester clear clf() // Read data - wavelength (in km)), power, 1 standard

Re: [Scilab-users] Multiple regression on semi-log plot

2020-11-09 Thread Stéphane Mottelet
Hi, This is an easy task that can be done by fitting a piecewise-affine function like this: y = a*(x-theta)+phi, for x < theta y = b*(x-theta)+phi, for x >= theta Here is an example : function y=fun(x, param) a = param(1); b = param(2); theta = param(3); phi =

[Scilab-users] Multiple regression on semi-log plot

2020-11-09 Thread arctica1963
Hello, I am looking to determine multiple regression lines from a single power spectral dataset (log power vs radial wavenumber), and was wondering if it is feasible in Scilab to compute something similar to the attached plot? I did locate a Matlab code for finding a turning point in a plot and