Answered
fminbnd not working for a single variable optimization problem
k1=fminbnd(@(k)valfun3(k,k0,z0,a0),kmin,kmax); instead of k1=fminbnd(@valfun3,kmin,kmax);

4 years ago | 0

| accepted

Answered
What to do with for-while loop?
number_on_dice = 6; bu = [ ]; while number_on_dice ~= 8 u = rand(); number_on_dice = sum(cdf <= u) + 1; bu = [b...

4 years ago | 0

Answered
Help regarding below question.
f = @(x) [functional equation] syms x df = diff(f,x); df_fun = matlabFunction(df); x = xstart:0.01:xend; % define interval ...

4 years ago | 0

Answered
Why ode45 returns NaN for a system of differential equations?
N = 10; Mi = zeros(N,1); c0 = zeros(N,1); Mi(1) = 14.01; c0(1) = 0.7809; Mi(2) = 16; c0(2) = 0.2095; Mi(3) = 39.95; c0(3...

4 years ago | 0

| accepted

Answered
calculate the rectified value
built_in_value = mean(abs(A(:)))

4 years ago | 1

| accepted

Answered
How to code a nonlinear vector-valued function so that it fits the coordinate grids (xq , yq) of triangles?
Here is the author's homepage: https://people.sc.fsu.edu/~jburkardt/ Just contact him.

4 years ago | 0

| accepted

Answered
Index in position 1 is invalid. Array indices must be positive integers or logical values. Error in explicitftcs (line 28) u(Nx+1,k) = 1.; >> u(Nx+1,k) = 1.; Index in
Nx should be the number of grid points in x-direction, not the length of these intervals. You mixed this up by setting Nx = 0.1...

4 years ago | 0

Answered
Extract positive value from solve function
If a and b contain no more symbolic constants, then you can use a = double(a); b = double(b); a = a(abs(imag(a)) < 1e-6); b ...

4 years ago | 0

Answered
How to Solve system of nonlinear PDE
Looks better, doesn't it ? Tin = 445; % Feed concentration L = 17; % Reactor length ...

4 years ago | 0

| accepted

Answered
How to plot a set as the constraint in 2D?
syms x y f = sqrt(x^2+y^2); ezplot(f, [0 10 0 10])

4 years ago | 0

Answered
Store function results from for loop
i = 0; for do_shaft = .04:.001:.14 for h = .01:.001:.10 for w = .01:.001:.10 Nf = func(inputs) ...

4 years ago | 0

| accepted

Answered
Finding global minimum with rand
fumin = Inf; for i = 1:100000 u = -6 + 12*rand(3,1); fu = f(u); if fu < fumin umin = u; fumin = fu; end...

4 years ago | 0

| accepted

Answered
Check if function handle is nonlinear with Matlab
Call your function handle f with symbolic vectors x and y and a symbolic scalar a and check whether f(x+y) - (f(x) + f(y)) - f(...

4 years ago | 1

| accepted

Answered
Solving a nonlinear system differential equation using symbols
Here is the sequence of commands to obtain the solution in Octave. One can use the "solve" directly for all variables, but I de...

4 years ago | 0

Answered
estimation of parameters by using lsqnonlin for system of differential equations
[B,resnorm,RESIDUAL,exitflag,OUTPUT,LAMBDA,Jacobian] = lsqnonlin(@Kinetics,B0,time,A_data,lb,ub,options ); This is not the corr...

4 years ago | 1

Answered
how to write hyper geometic function
https://de.mathworks.com/help/symbolic/hypergeom.html

4 years ago | 0

Answered
Obtaining values for variable on the left and right hand side
You can't achieve 0=0 since 0.5 / (1 + 0.2 * (x2)^2) is always positive. But if you choose x1 = (0.5 / (1 + 0.2 * (x2)^2))/(...

4 years ago | 0

Answered
How do i use ode23 if i have a spline function?
Ta = 273.15 + 10; fun = @(tt) ppval(spline(t,k),tt); fun_ode23 = @(t,T) fun(t)*(T-Ta); T0 = 273.15 + 50; tspan = [0,1]; [t,...

4 years ago | 0

| accepted

Answered
ODE45 solving rate too low
I can't see something wrong in the equation itself, but of course I don't know if the inputs have the correct units etc. But fo...

4 years ago | 0

Answered
inserting index for variable
I don't know what you mean by "I want make index for my variable", but x = 8; b = 9; w = zeros(2,1); u = zeros(2,1); for i ...

4 years ago | 0

Answered
Bayesian Optimization for constrained optimization in fmincon?
I have been doing constrained optimizations of underdetermined systems of linear equations with fmincon. Isn't "lsqlin" the app...

4 years ago | 2

Answered
making pde matlab code
Here is a simple code to check your results from pdepe: % Spatial interval L = 1; nL = 101; dL = L/(nL-1); eta = linspace(0...

4 years ago | 0

Answered
Can I use custom sum of two mean sum square cost functions for lsqnonlin?
Your output must be output = [(RecPar1(:) - TruePar1(:)) / sqrt(length(TruePar1)) ; (RecPar2(:) - TruePar2(:)) / sqrt(length(Tr...

4 years ago | 0

| accepted

Answered
Solve function:Error using sym/solve>getEqns
"qfunc" does not accept symbolic input, and your B is symbolic.

4 years ago | 1

Answered
solving an ODE with a constraint equation
As you said: You will have to couple a nonlinear solver with an ODE integrator. I changed the ODE to dy/dx = a*x because of the...

4 years ago | 0

| accepted

Answered
Sine equation in Euler Method ODE
% 2D SYSTEM SIN-COS EQUATIONS USING FORWARD EULER METHOD % solve u'(t) = F(t,u(t)) where u(t)= sqrt(t+1)*cos^2(t),sqrt(t+1)*sin...

4 years ago | 0

| accepted

Answered
How do I interpolate derivative values at endpoints with interp1?
Look at the forward (first element) and backward (last element) finite difference coefficients in the link and choose those you ...

4 years ago | 0

Answered
Where does the diffrence beetween lsqcurvefit and data come from?
Does this answer your question ? 1st code (free radius): load('data-ask.mat') fun =@(x)(xdata1-x(1)).^2+(ydata1-x(2)).^2 - x(...

4 years ago | 0

| accepted

Answered
Ax = 0 with 2 values of x known
Use lsqlin for the problem min : ||A*x||_2 s.c. x(1) = known_value_1 x(n) = known_value_2 if A has n columns.

4 years ago | 0

Answered
Problems with the diff function
syms x y M = 2*y - 2*x*y^3 + 4*x + 6; N = 2*x - 3*x^2*y^2 - 1 ; cond = diff(M,y) - diff(N,x)

4 years ago | 0

Load more