Answered
How are initial values chosen for either lsqcurvefit or nlinfit functions?
There must be some mathematical operation within your objective function that gives Inf, NaN or something similar (e.g. division...

8 years ago | 0

Answered
differentiation for a function
syms x y(x) diff(x-y^2,x) Best wishes Torsten.

8 years ago | 0

Answered
how to stop dde23 when one of states reach certain value?
Use the "Events" option of dde23. Best wishes Torsten.

8 years ago | 2

| accepted

Answered
How to set open boundary conditions with Pdepe for advection-diffusion-reaction of concentrations?
Choose your interval where you solve your equations big enough. This way, you won't come into trouble with the boundary conditio...

8 years ago | 1

| accepted

Answered
simultaneous fitting of two plots with two functions
xdata=[x(:,1); x(:,1)]; ydata=[y1(:,1); y2(:,1)]; fun=@(x,xdata) [f1(xdata(1:numel(xdata)/2),x(1),x(2),x(3),x(4)); f2(x...

8 years ago | 0

Answered
simultaneous fitting of two plots with two functions
Use "lsqcurvefit" with the data set xdata = (x,x),ydata = (y1,y2). Best wishes Torsten.

8 years ago | 2

| accepted

Answered
Is it possible to use DuDx as boundary condition in pdepe if DuDx doesn't appear in the equation in a system of PDE/ODE?
Mathematically, an ODE does not need a boundary condition - the value of an ODE in a boundary point is given by solving the ODE ...

8 years ago | 1

| accepted

Answered
1st order differential equation , boundary conditions
syms y1(t) y2(t) eqn = [diff(y1,t) == y2*y1*log(450/y1), diff(y2,t) == 0]; cond = [y1(0)==40, y1(15)==95]; [y1Sol(t) ...

8 years ago | 0

| accepted

Answered
1st order differential equation
This is a boundary value problem - use "bvp4c" instead of "ode45". Or try "dsolve". Best wishes Torsten.

8 years ago | 0

Answered
Problem of integral combined with fzero
Instead of specifying a point (0.01) in the call to "fzero", you should specify a search interval which excludes the point c0=0....

8 years ago | 0

| accepted

Answered
could anyone help me to solve the issue in the following code
X=[3] for t=1:length(X) A = partitions([X(t)]) for d=1:length(A) if length(A{d})>1 for e=1:leng...

8 years ago | 1

| accepted

Answered
How can I solve a system of differential equations of second order?
Write your system as w1' = w2 w2' = k*(w4*B3(w1,w3,w5)-w6*B2(w1,w3,w5)) w3' = w4 w4' = k*(w6*B1(w1,w3,w5)-w2*B3(w1...

8 years ago | 0

Answered
CDF and Inverse CDF of Wrapped Cauchy Distribution
function main p = linspace(0,1,11); prob = linspace(0,1,100); x = zeros(numel(p),numel(prob)); for ...

8 years ago | 1

| accepted

Answered
matlab pdepe boundary conditions help
"pdepe" is a solver for parabolic/elliptic partial differential equations of 2nd order. Your equations are hyperbolic equations ...

8 years ago | 0

Answered
Multiple parameters optimization having calculated and experimental values
function main P_k = ...; Hcexp = ...; T_k = ...; z = ...; w = ...; v = ...; c = ...; a...

8 years ago | 1

| accepted

Answered
How to find the exact solution of heat equation U_t=U_xx bc U(0,t)=0=U(1,t), U(x,0)=sin(pix). Also Matlab code?
Easy: fun = @(x,t)sin(pi*x).*exp(-pi^2*t); x = linspace(0,1,50); t = [0.0 0.1 0.2]; [X,T] = meshgrid(x,t); U = ...

8 years ago | 0

Answered
Create a vector z with 1000 elements generated by the rand-function. The generated values must have a mean value of 0.5 (mean(0.5)). And a standard deviation of sqrt(1/100*12), (std(x)).
0.5*(a+b) = 0.5 1/12*(b-a)^2 = 0.12 Solve for a and b. This will give you the interval [a b] for which you must gener...

8 years ago | 2

Answered
Differential Equation with Coefficients as Integral Functions
fun=@(x,y)[y(2);-y(2)*integral(@(z)z.^2+3*z-1,0,x)]; is a suitable function to be used with ODE45, and it represents your d...

8 years ago | 1

| accepted

Answered
calculating sum of an array by using if-or statement in matlab
Deger = [20 25 27 28 31 32 33 34]; Node1 = [1 2 5 6 7 4 3 3]; Node2 = [2 5 6 7 4 3 2 6]; minimum = min(min(Node1),min...

8 years ago | 0

| accepted

Answered
how to define an integral function
fun=@(z)z.^2+3*z-1; F=@(x)integral(fun,0,x); F(10)

8 years ago | 2

| accepted

Answered
Square of 20 random number sum up to 1
r = r / sqrt(sum(r.^2)) Best wishes Torsten.

8 years ago | 0

Answered
How to fit a curve with negative powers of x
If you want to fit parameters a0,...,an to a function of the form y = a0 + a1*x^(-1) + a2*x^(-2) + ... + an*x^(-n) you c...

8 years ago | 0

Answered
could anyone help me how to write the bell number equation in matlab
nfinal = 10; b(1)=1; for i=2:nfinal+1 b(i)=0.0; for j=0:i-2 b(i)=b(i)+nchoosek(i-2,j)*b(j+1) end ...

8 years ago | 0

| accepted

Answered
Coupled differential equation system
Write your system as L11*di1/dt+L12*di2/dt+L13*di3/dt = v-r*i1 L21*di1/dt+L22*di2/dt+L23*di3/dt = v-r*i2 L31*di1/dt+L...

8 years ago | 0

| accepted

Answered
How can i minimize a function provided that another function is greater than 0?
Use "nonlcon" to set the constraint sum(2000*(1/(2*5))*((first(A)-D*[2:7]).^2-(first(A)-D*[1:7-1]).^2)) >= 0 Best wishes...

8 years ago | 1

| accepted

Answered
How can I multiply 4D array? Optimization assignment problem
Use "reshape" to turn your 4d-matrices into an 1d-vector, multiply the vectors componentenwise and sum.

8 years ago | 0

| accepted

Answered
How to have Ode45 display an answer to an array input?
I changed the ODE, but the way to solve an equation for several parameters should become clear. function main nt = 11; ...

8 years ago | 0

Answered
Is there any mistaken on my fmincon solve?
fmincon works with arrays, not with scalar variables. Thus you have to place your scalar variables to be optimized (dec_val, acc...

8 years ago | 1

| accepted

Answered
MATLAB event function help
function main tRange = [0 10]; Y0 = [0 20]; options = odeset('Events',@event_function) [tSol,YSol,te,ye,ie] =ode45...

8 years ago | 0

| accepted

Answered
Help needed with while loop code
while RF_tot<=8 && D_var <= 30 D_var=D_var+1 RF_tot=RF_tot+RF(D_var) end Best wishes Torsten.

8 years ago | 0

| accepted

Load more