# Curve fitting with LsqFit

**URL:** <https://discourse.julialang.org/t/curve-fitting-with-lsqfit/27685>\
**Category:** New to Julia\
**Created:** [August 18, 2019, 6:45pm UTC](https://discourse.julialang.org/t/curve-fitting-with-lsqfit/27685 "2019-08-18T18:45:31Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![KirillGerke](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kirillgerke/32/11383_2.png) [@KirillGerke](https://discourse.julialang.org/u/KirillGerke)\
**Post date:** [August 22, 2019, 8:23am UTC](https://discourse.julialang.org/t/curve-fitting-with-lsqfit/27685/5 "2019-08-22T08:23:40Z")

</div>

Thank you! It is much clearer now.  
Yet, there is a new problem. Now i am trying to use a complex function with ternary operator:

```julia
model1(t, p) = @.(p[1] * exp(-p[2] * t) + p[3] * exp(-p[4] * t) * cos(p[5] * t + p[6])+ p[7] * (t > p[8] ? 0 : (1 - t / p[8])^2))

```

The error i get is the following:

```julia
ERROR: TypeError: non-boolean (BitArray{1}) used in boolean context
Stacktrace:
 [1] model1(::Array{Int64,1}, ::Array{Float64,1}) at .\REPL[184]:1
 [2] top-level scope at none:0

```

Many thanks in advance for tips.

---

_[View the full topic](https://discourse.julialang.org/t/curve-fitting-with-lsqfit/27685)._
