2
votes

I have a problem with a curve fitting in gnuplot with my data:

If I use these commands:

plot "sky.txt"
f(x)=A*exp(-(t)/(sin(x)))+B

fit f(x) "sky.txt" u 1:2 via A,t,B
plot "sky.txt", f(x)

Then I get strange results, like errors of +- 1093% When I'm plotting this I get a very strange plot.

This is measured data. I have no idea what's wrong in here. Thank you for help.

enter image description here

1
Welcome to StackOverflow! x seems to be your independent variable and you want to fit an exponential decay. So, are you sure your function shouldn't be something like: f(x)=A*exp(-(x)/(sin(t)))+B? Please provide the data if you want it to be reproduced and tested. - theozh
-t is the variable that i search. A and B are irrelevant for further calculation. Thanks I posted the data below. - looop
I assume x is the angle and it should be in degrees?! If yes, then you have to tell gnuplot set angle degrees. Check help angles. Default is radians. - theozh
thank you!!! that was the problem. Thank you very much. - looop

1 Answers

0
votes

... the comment again as answer, according to the StackOverflow "rule": no answers in comments!

You have to set the angles to degrees via: (check help angles). Default is radians.

set angles degrees