[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fitting function
From: |
mrodrig |
Subject: |
Fitting function |
Date: |
Fri, 9 Aug 2019 21:31:04 -0500 (CDT) |
Hello,
I am new with octave.
I have a data set (x,y) and I have a theoretical function that depend on the
x value. In other words, for example, for x < b, f=10*x*a and for x>=b,
f=-10*x*a. I need to perform the fitting of the theoretical function to the
experimental data and obtain the value of R parameter.
Here is my code example
x=[1,2,3,4,5,6,7,8,9,10];
y=[0,2,6,10,12,10,7,5,1,0];
R=2;
N=1;
plot(x,y)
hold
for r=min(x):1:max(x)
if x(N) < 5
y(N)=10*x(N)*R;
elseif x(N) >= 5
y(N)=-10*x(N)*R;
endif
N=N+1;
endfor
I used R=2 as a starting parameter
How can I do?
It is possible to use leasqr?
thanks very much
--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
- Fitting function,
mrodrig <=