Answered
Solve double integral using 'integral2'
y = sqrt(100-x^2-z^2) or y = -sqrt(100-x^2-z^2) -> I = integral_{x=0}^{x=10} integral_{z=0}^{z=sqrt(1-x^2)} (x+sqrt(100-...

8 years ago | 0

| accepted

Answered
Numerically stable implementation of sin(y*atan(x))/x
By L'Hospital, lim (x->0) sin(y*atan(x))/x = y. Thus define your function to be y if x=0 and sin(y*atan(x))/x if x <> 0. ...

8 years ago | 1

| accepted

Answered
How to plot a differential equation?
function main % call root finder estimate0 = 1.0; estimate = fzero(@cycle,estimate0); % call bvp4c for fin...

8 years ago | 0

| accepted

Answered
How can I fix this problem
for i = 1:numel(C) F = [A, B, C(i), D, E]; G{i} = roots(F); end Best wishes Torsten.

8 years ago | 0

| accepted

Answered
Solving trigonometric equations as a optimization problems
function fcost=cuptpc(x) L = 22.5e-6; A1 = 40; A2 = 40; A3 = 40; n=1; f=20e3; M = 1.0; / ???? A = 1...

8 years ago | 0

| accepted

Answered
Solve double intergral ?
sol=integral2(@(x,y)x+y+sqrt(100-x.^2-y.^2),0,10,0,@(x)sqrt(100-x.^2)) Best wishes Torsten.

8 years ago | 0

| accepted

Answered
optimization with integer constraints
https://de.mathworks.com/help/optim/examples/mixed-integer-quadratic-programming-portfolio-optimization.html Best wishes T...

8 years ago | 2

Answered
Need help on loop for an ODE function
t=0.01:0.01:20; for i=1:numel(t) solinit = bvpinit(linspace(0,1,10),[0,0]); sol{i} = bvp4c(@(y,u)ex1ode(y,u,t(i))...

8 years ago | 0

| accepted

Answered
I would like to know how to implement a bivariate normal distribution.
rhoR=0.5; fun=@(x,y)1/(2*pi*sqrt(1-rhoR^2))*exp(-1/(2*(1-rhoR^2))*(x.^2-2*rhoR*x.*y+y.^2)); intfun=@(R)integral2(fun,-In...

8 years ago | 1

| accepted

Answered
Hi, is this the right code for the pde (∂u/∂t= 2 + (∂^2 u)/(∂x^2 )) with boundary conditions of 0.5 and 3.5 and initial condition of x^2 - 0.5 where x ranges from -1 to 2?
It's more usual to define c = 1; f = dudx; s = 2; instead of c = 1; f = 2*x + dudx; s = 0; but the c...

8 years ago | 0

| accepted

Answered
Evaluating polynomial at a certain x point to find y?
coeff{i} = polyfit(volHotLiq, volIce, i); if i==4 p_15 = polyval(coeff{i},1.5); end

8 years ago | 1

Answered
How can I solve non-linear equations ?
help fsolve Best wishes Torsten.

8 years ago | 0

Answered
How to optimize a function?
x1=0; x2=20; fun=@(x)x^2+2x-3; x = fminbnd(fun,x1,x2)

8 years ago | 0

| accepted

Answered
Solve integral for x with x as bound and part of the integrand
a=0.2; b=10; c=-10; d=15; mu=3; sig=1; Pdf=@(x)1/(sig*sqrt(2*pi))*exp(-(x-mu).^2/(2*sig^2)); Cdf=@(x)inte...

8 years ago | 0

| accepted

Answered
lsqnonlin output only converging towards function in increments of length(x0)+1
lsqnonlin needs the derivatives of your functions with respect to the parameters. Thus "myObjective" is called with almost the s...

8 years ago | 1

| accepted

Answered
Polyfit with odd powers only?
x = [ ... ]; y = [ ... ]; x = x.'; y = y.'; n = 5; % degree of polynomial p ; n must be odd A = []; ...

8 years ago | 1

| accepted

Answered
Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 2-by-1.
Allocate "gamma_element" before you enter the loops: gamma_element = zeros(2,2^9); for i=1:10 ... Best wishes ...

8 years ago | 0

Answered
second order ode45-where to put boundary and initial condition?
u(r) = -1/(16*B)*dp0/dz*(1-r^2) If the analytical solution is not what you want, use "bvp4c" instead of "ode45". Best wi...

8 years ago | 0

Answered
How to add variable to ode45 method?
The actual longitudinal coordinate z is transferred to your function "fun" by ODE45: function f=fun( *z*,p) You can...

8 years ago | 0

| accepted

Answered
BVP solver with an array of initial conditions
solinit = bvpinit(linspace(xlow,xhigh,10),@init); function yinit = init(x) yinit = [ x 1-2*x ]; Be...

8 years ago | 0

Answered
How to use bvp4c for boundary value problem with 2 unknown parameters?
fprintf('For r=%4.2f a= %4.2f \n',sol.parameters); Best wishes Torsten.

8 years ago | 0

| accepted

Answered
Does anyone could help me out with this RK4 code, the code runs but it does plot nothing
function rungekutta h = 0.1; %tama?o de paso aleft = 0; aright = 1; n = (aright-aleft)/h; %cantidad de subinterva...

8 years ago | 0

| accepted

Answered
How to discretize variables related by a formula?
n=10; X=1:n; Y=sin(X) Best wishes Torsten.

8 years ago | 1

Answered
How to use numerical solution in differential equation?
Use MATLAB's "diff" on the array of p-values to approximate dp/dz: https://de.mathworks.com/help/matlab/ref/diff.html Best...

8 years ago | 0

Answered
Optimizing ODE parameter to make solution fit empirical observations
[t,y] = ode15s(@(t,y)myModel(t,y,k0),Time,y0); function dydt = myModel(t,y,k) dydt = k; Best wishes Torsten.

8 years ago | 1

| accepted

Answered
What is the difference between function and objective function in MATLAB ?
No difference - "objective function" is just the terminus technicus for the function you want to maximize or mimimize in optimiz...

8 years ago | 1

| accepted

Answered
How can i find theta and polarplot a function for rho > 0.
theta=pi/21:0.1*pi/21:5*pi/21; rho=1-2*cos(7*theta); polarplot(theta,rho)

8 years ago | 0

Answered
bvp4c or ode45?
If you know $p_0|_{z=1}=1$ and $p_1|_{z=1}=0$ and you want to know $p_0'|_{z=0}$ and $p_1'|_{z=0}$, you don't need a shooting me...

8 years ago | 1

| accepted

Answered
Solve 4 equations with 3 unknowns
Cd=...; Z=...; fun=@(x)[1-x(1)-Z*x(1)*x(2);1-x(2)-Z*x(2)*(x(1)+x(3));-x(3)+Z*x(2)*(x(1)-x(3));-Cd+Z*x(2)*x(3)]; lb=[0...

8 years ago | 0

| accepted

Load more