-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow non-vectorized model functions? #12
Comments
Here's a reduced example that might reveal what's going on:
|
Yes, exactly that is it, but it is going internally on the
returns the same error. |
@mlubin was just being nice. He was trying to tell you the bug is on your end. When you define the function, you need to use elemental operations like Specifically, you need to write
Note the extra period before the power. |
Oh, I know he was nice, anyone who responds is doing good. Was I rude? in that case my apologies, probably is because I write a bit rough. Going back to the issue, yes, it seems to be that I don't understand the point syntaxis in Julia well. How is that p[1] is NOT an element of an array? I put the point in every operator now and it works, but I still don't understand what it is supposed to mean (well I have another error now...) |
No, you were not rude. Sorry if I implied that.
Here is a simple example.
You are thinking of the function like the second line, while inside |
I had this problem, but I didn't understand how to use the point yet. I put in diferente places but the ERROR continuing coming. Someone can help or say where I can find a tutorial about that? `model(t, p) = ((p[1]*p[2])/(sqrt((1/sqrt(p[3]p[4]))^2-(p[2]/(2p[3]))^2)*p[3]))*sin(sqrt((1/sqrt(p[3]p[4]))^2-(p[2]/(2p[3]))^2)*t)exp(-(p[2]/(2p[3]))*t) fit = curve_fit(model, time, Volts, [Vm, R, L, C])` |
@CaBeOli, when your model is evaluated, the model(t, p) = ((p[1]*p[2])/(sqrt((1/sqrt(p[3]p[4]))^2 -
(p[2]/(2p[3]))^2)*p[3])) * sin(sqrt((1/sqrt(p[3]p[4]))^2-(p[2]/(2p[3]))^2)*t)
.* exp(-(p[2]/(2p[3]))*t) |
Maybe the more appropriate question if whether we should modify LsqFit.jl to not require the user to write their model in a vectorized form? |
Maybe with julia v0.6 it is enough to exemplify the use of the new @. macro in the README example? |
I agree. |
It seems it cannot. When I use a model that multiplies a parameter within itself, a no method error appears.
And I get this beautiful error
I have already tried to write the function in different ways, but it seems that somewhere, inside the fit, the routine tries to multiply the parameters without knowing what are they.
My Julia is 0.4.3 and LsqFit is the last one avaible.
The text was updated successfully, but these errors were encountered: