0

I have a huge series of a nonlinear function.

3240910002558383085492736408270606958592 sin(x3_)   23950603179913084375 k10 x6_   23950603179913084375 k9 x5_
------------------------------------------------- - ---------------------------- - ---------------------------
                        #4                             25973015655783048675328       25973015655783048675328

                                                  2
     816555808152780085063004140309315584 cos(x3_)  sin(x3_)   64261963098890133504 k5 x1_   64261963098890133504 k6 x2_
   + ------------------------------------------------------- + --------------------------- + ---------------------------
                                #2                                          #5                            #5

                                                                                                    2
     64261963098890133504 k7 x3_   64261963098890133504 k8 x4_   2414846496921978125 k9 x5_ cos(x3_)
   + --------------------------- + --------------------------- + ------------------------------------
                  #5                            #5                      10625324586456701730816

I am succeeded in simulation, the result of this simulation is around of 0.01 up to 2. But its elements and computation are so complicated. I would like to simplify it, then use that result to run in a C program. I also try to use vpa, but that is a bad result due to the difference between the huge number and the small value so it makes a wrong approximation on the result.

vpa = (2.6737e-21*(4.4485e90*sin(x3_) - 9.4197e86*x4_^2*sin(x3_) + 1.19e90*cos(x3_)*sin(x3_) - 5.9344e88*k1*x1_ ...

In the other hand, my idea is can I do some function to get the factor like below: Assume f = a1*sin(x)*y*y + a2*x*x/(cos(x)^3). Any function in Matlab that I can achieve a1, a2?

Moreover, in C language, the maximum number of int32 is limited, so I am looking for a solution for this problem. Please help to give me some suggestion. Thank in advance!

Karim
  • 252
  • 1
  • 4
  • 17

1 Answers1

0

You can use the fit function. To solve

f = a1*sin(x)*y*y + a2*x*x/(cos(x)^3)

You can use fittype to define your custom function. Rest should be straight forward from the documentation if I understand your problem correctly.

Another option is to use a LUT for your function.

Sardar Usama
  • 19,536
  • 9
  • 36
  • 58
AGD
  • 34
  • 3