modify function pass it array
Hi I have a function that perfroms a complex mathematical algortihm. I want to modify it to take my equation rather than use the example equation. By the way this is the equation to solve, not the equation that performs the mathematics...
The function to perform the algorthm is in main here:
rosen is the function that holds the equation i want to solve, simplex is the function that will perform the maths.
The function rosen is like this:
My problem is passing rosen the arrays Actual_Output and Input. These are 5 by 1 vectors really, and I want the least squares error returned to the call function. I am not sure whether I have to use loops or can it do all the calculations just knowing those are vectors?
double rosen(double x, double Actual_Output, double Input)
c = -1/atanh((exp(x*2*pi)-cosh(x*x*Actual_Output))/sinh(x*x*Actual_Output));
Fitted_Curve = (1/(x*x))*(c-asinh(sinh(c)*exp(x*Input*2*pi)));
I am really a matlab user but I need to use c for this project. please can someone give me a hand.