Answered
Absolute Value in optimization expression
min: eps + (a*x + b*y + c*z - d) - eps <= 0 - (a*x + b*y + c*z - d) - eps <= 0 subject to x,y,z are integers in some range wi...

7 years ago | 1

Answered
How to find parameters of differential equation which fit data using gradient descent?
This is the standard example on how to proceed in your case: https://de.mathworks.com/matlabcentral/answers/43439-monod-kinetic...

7 years ago | 0

Answered
Solving System of Marices
N = 100; fun = @(x) x.^2 - Dg*x - Di; x0 = zeros(N,1); sol = fsolve(fun,x0)

7 years ago | 0

| accepted

Answered
how to creat this vector?
X=[1 0 0 1 1 0 1 1 1 1 0 0 0 1 1 0 1 1 1 1 1 0]; if sum(X)>3 X=[0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 0]; end

7 years ago | 0

Answered
system of non linear equations of the same form
x = fsolve(@(x)myfun(x(1),x(2:n),x0)

7 years ago | 0

| accepted

Answered
traveling salesman problem code
https://de.mathworks.com/matlabcentral/answers/441041-how-to-compute-possible-route-for-travelling-salesman-problem

7 years ago | 0

| accepted

Answered
The inverse of a function numerically with N-terms
p = [b*fliplr(m((N+2)-N:(2*N)-N)),b+a*m(1),-z,a+b*m(1),b*m(N-(N-2):N-0)]; roots(p)

7 years ago | 0

| accepted

Answered
Solve a numerical equation
x0 = 0 leads to a divison by zero since sin(x0/2) = sin(0) = 0

7 years ago | 0

Answered
How to divide unequally between two points such that nearby one point the discretization points will be crowded and on the other end it will be uniform
theta(1)=0.05; for n=2:40 theta(n)=theta(n-1)+1e-12*2.016233701097243^(n-1) end

7 years ago | 0

| accepted

Answered
solving linear systems of equations
The matrix C is singular. Check whether the linear system C*x=D is solvable at all (Remember the rank condition rank (C ) = ran...

7 years ago | 0

Answered
non-linear fit to find constants in the equation
E =...; % column vector U =...; % column vector A = [ones(numel(E),1), E, E.^2, E.^3, E.^4]; b = U; sol = A\b; C1 = sol(1...

7 years ago | 1

| accepted

Answered
BVP4c Solving two equations simultaneously
init = bvpinit(linspace(0,1,10),[0,0,0,0,0]); sol = bvp4c(@rhs_bvp, @bc_bvp, init); x1 = linspace(0,1,100); BS = deval(sol, x...

7 years ago | 0

Answered
How to calculate the derivative of function that is referred to in another function?
syms x func =-2.18 +5.0768*x-2.6870*(x^2)+0.5129*(x^3)-0.0318*(x^4); dfunc = diff(func,x);

7 years ago | 0

| accepted

Answered
Numerical calculation of line integral over a vector field
The usual way is to approximate the integral as sum_{i=1}^{n-1} [ (rx(t(i+1))-rx(t(i))/(t(i+1)-t(i)) * Fx(gamma((t(i+1)+t(i))/2...

7 years ago | 0

Answered
Solving system of equations with constraints
Linear optimization codes that use the simplex method always return corner points of the LP problem as solution. Maybe options...

7 years ago | 0

Answered
norminv to solve for sigma
x = ...; mu = ...; p = ...; sigma0 = 1.0; sigma = fzero(@(y)normcdf(x,mu,y)-p,sigma0)

7 years ago | 1

Answered
I am getting error in integrating a function from 0 to infinity wrt x. Kindly help.
q=integral(fun,0,Inf,'ArrayValued',true)

7 years ago | 0

Answered
I am trying to solve 3 simultaneous nonlinear system of equations by newton's method.
Don't use symbolic variables together with Newton-Raphson. Instead of using "jacobian" , look at the solution suggested by John...

7 years ago | 0

| accepted

Answered
Solving 2 second order differential equations
Take a look here https://de.mathworks.com/help/symbolic/solve-differential-algebraic-equations.html to see how to setup your ...

7 years ago | 0

Answered
Using ode45 to model equations of motion for a coupled nonlinear system of ordinary differential equations
subplot(212) R = 5.938; plot(t,z(:,3)*R); grid on xlabel('Time (sec)'); ylabel('\zeta_s');

7 years ago | 0

| accepted

Answered
Best Cubic Polynomial fitting
mat = [a a.^3]; rhs = b; sol = mat\rhs; p = sol(1) q = sol(2) fun=@(x) p*x + q*x.^3; bb = fun(a); plot(a,b,a,bb)

7 years ago | 0

Answered
Error: The first argument must be a scalar.
dd = [diff(d(1),X(1)),diff(d(2),X(2)),diff(d(3),X(3)),diff(d(4),X(4))]

7 years ago | 0

| accepted

Answered
Solution to speed up loop with gamma distribution (gampdf)?
100 sec to beat: faktor = 1.0./(beta.^alpha.*gamma(alpha)); for i = 1:n TTD(:,i) = faktor(i)*t.^(alpha(i)-1.0).*exp(-t/bet...

7 years ago | 0

| accepted

Answered
How to supply user gradient in simultaneous fitting with lsqcurvefit
From the documentation: If the Jacobian can also be computed and the Jacobian option is 'on', set by options = optimoptions(...

7 years ago | 0

Answered
How to Integrate an ODE
U^6(x)*O^2(x) - U^6(0)*O^2(0) = 0.45*nu*integral_{x=0}^{x=x} U^5(x) dx Solve for O(x).

7 years ago | 0

Answered
First order partial differential equations system - Numerical solution
%program solves % dy1/dt + v1*dy1/dx = s1*y1*y2 % dy2/dt + v2*dy2/dx = s2*y1*y2 % y1(0,x) = y2(0,x) = 0 % y1(t,1) = y2(t,0) ...

7 years ago | 2

| accepted

Answered
second order data fitting using least squares
x = [0.81 0.85 0.91 1.00 1.17 1.33 1.36 1.37 1.39 1.40 1.42]; y = [0.58 0.69 0.81 0.93 1 0.91 0.84 0.80 0.74 0.67 0.59]; x0 = ...

7 years ago | 0

Answered
How to write a summation code when the k is not equal to j
If all arrays involved have K elements, you can use h = ...; lambda = ...; f = ...; S = sum(h); H = S-h ; result = sum(...

7 years ago | 0

Answered
why tis matrix is sparse?
Calculate number_of_nonzeros/(number_of_rows*number_of_columns) and you'll see that the matrix is sparse.

7 years ago | 0

Load more