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

arctica1963 arctica1963 at gmail.com
Mon Nov 9 17:07:37 CET 2020


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 perhaps
this may be a route to find the change in curvature?

clear
clf()
//to find the "knee"
dt = 0.01;
t = 0:dt:1;
y = exp(-10*t);
//Compute first and second derivatives by finite differencing (centred)
//yp = nan(size(y));
//ypp = nan(size(y));
yp=%nan*y; // similar behaviour to Matlab nan(size(y))
ypp=%nan*y;
yp(2:$-1) = (y(3:$) - y(1:$-2))/(2*dt); // first derivative
ypp(2:$-1) = (y(3:$) + y(1:$-2) - 2*y(2:$-1)) / (dt^2); // second derivative
//Compute the curvature
k = abs(ypp) ./ (1 + yp.^2).^1.5
//Find the maximum curvature point and plot it on the curve
[kmax, idx] = max(k);
plot(t, y, 'b', t(idx), y(idx), 'ro')
//plot the curvature
figure()
plot(t, k)

Any pointers or ideas would be welcome.

Thanks
Lester

<http://mailinglists.scilab.org/file/t495709/Capture_Radial-averaged-power_spectra.jpg> 



--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html



More information about the users mailing list