Answered
I need to solve a system composed by four coupled equations: three ODE and one algebric non-linear equation.
You can try a differential-algebraic solver like ode15s that accepts a mixture of differential and algebraic equations by defini...

2 years ago | 0

| accepted

Answered
fsolve with bound constraints - transformation method
Transformation and initial values are two independent problems that both have to be solved. You cannot compensate "bad" initial ...

2 years ago | 0

Answered
implicit numerical method: 1-D unsteady state heat transfer using finite difference method
pde() function pde() % Constants Ly = 0.0015; % Total thickness of the system (meters) T = 40; % Total s...

2 years ago | 1

| accepted

Answered
Interpolating data to get values at specific depth
Make X and Y also 224x164x37 (just by repeating the planar profile 37 times) and use interp3 to interpolate to the depth of your...

2 years ago | 2

| accepted

Answered
How can I find the vector that simultaneously maximizes my two functions?
Usually, you can't find a vector that maximizes both of your functions simultaneously. You can compute the pareto-front for your...

2 years ago | 1

Answered
Solving nonlinear system of PDE by using finite difference method for spatial and RK4 for time derivative?
You need two boundary conditions for Tap, one boundary condition for Tsg and one boundary condition for Tag. Your equation for ...

2 years ago | 1

Answered
PDE solve with bvp4c
Take a look here on how boundary value problems with two regions (in your case -1 to 0 and 0 to 1) have to be set up for bvp4c: ...

2 years ago | 0

Answered
Solve a system of nonlinear differential equations
Define the unknown functions as y(1) = F, y(2) = dF/dx, y(3) = G, y(4) = dG/dx, y(5) = H. Then the equations are dy(1)/dx = y(...

2 years ago | 1

Answered
I need some help to solve non-linear equation with three unknowns and three knowns with having 170 different values for one known.
M = [eta+1,Rz,-Ry;-Rz,eta+1,Rx;Ry,-Rx,eta+1]; M = repmat(M,170,1); b = []; for i = 1:170 b = [b;Xw(i)-Tx;Yw(i)-Ty;Zw(i)-Tz...

2 years ago | 0

Answered
How can I skip the rest of an if statement?
Also in for-loops, "break" only exits the inner structure, but the outer loop runs until the end (see below). Thus you cannot ...

2 years ago | 0

Answered
Error using vertcat Dimensions of arrays being concatenated are not consistent..
Most probably: second_derivative = diff([0, diff(Ida_normalized(i:window_end))]); instead of second_derivative = diff([0; dif...

2 years ago | 1

| accepted

Answered
Surface plot doesn't correspond to optimization solution
The problem is now, when I select a point randomly in the surface plot, and then calibrate the model for these values, I do not ...

2 years ago | 0

| accepted

Answered
Solving an equation with symbolic matrix
https://uk.mathworks.com/matlabcentral/answers/1918100-error-using-solve-with-symmatrix-equation

2 years ago | 1

Answered
A group of 12 people all roll a pair of dice 12 times, how often does each person roll a total number that is greater than or equal to 7?
In my opinion, it should be roll1=randi(6,12); roll2=randi(6,12); total=roll1+roll2; GT7 = total>=7; totalGT7 = sum(GT7,1);...

2 years ago | 1

| accepted

Answered
error in for loop
u(j-3) is only defined for j>=4, u(j+3) is only defined for j<=length(R)-3. Similar restrictions hold for the other indices. Thu...

2 years ago | 0

Answered
I'm suppose to plot the response of the system but i'm getting wrong values
alpha is a constant , and this is the value of it , I doubt that the rate of change at t=0 for x(5) should be 2.55e17 as you g...

2 years ago | 0

Answered
How can I multiply a row vector with each of two column vectors?
t = [1 2]; s = [(1:3)',(4:6)']; kron(t,s)

2 years ago | 3

Answered
final value of x in PDE
i want to solve this equation for r at given time and concentration I assume that the time for which you want to get r is in th...

2 years ago | 0

Answered
How to prevent substrate concentration going below minimum limit in fed batch fermentation model.
You can use the "Events" option of the ode integrators to interrupt and restart integration with different settings if a certain...

2 years ago | 0

| accepted

Answered
How can I ensure that the initial solution (x0) for fsolve does not result in Inf or NaN values?
You know your "external_fun" best. Try to deduce in advance which inputs will lead to failure. Maybe you can use "lsqnonlin" ins...

2 years ago | 0

Answered
Huge minimum value from expected results
I cannot run this code because it takes too long or maybe the matrix exponential cannot be computed analytically. Does it give ...

2 years ago | 0

| accepted

Answered
ODE45 solver returning constant value as the input variable.
As you can see when you run the below code, p is in the order of 1e12 which makes dL/dt effectivly 0. Check your units. %Def...

2 years ago | 1

| accepted

Answered
The code does not converge
I seems your function does not vary much with rho. The evaluation cannot find a value for rho for which the function has a zero....

2 years ago | 0

| accepted

Answered
How to plot the error of two numerical methods on the same graph?
%% Given data f=@(x) 8-4.5*(x-sin(x)); df=@(x) -4.5*(1-cos(x)); x0=1; tol=0.0001; n=50; [x_newton,i_newton,Error_newton]=n...

2 years ago | 1

Answered
Modifying the objective function in order to meet the optimization variable boundaries
if (A <= 1e-04) & (A >= 4e-04) How can A be <= 1e-4 and >= 4e-4 at the same time ? And if-statements have to be done elementwi...

2 years ago | 0

Answered
Solve a matrix equation
D = eig(A) will give you the values for D for which det(A-DI)=0

2 years ago | 0

| accepted

Answered
Solving goal programming problem with MATLAB
x0 must be a vector of size 1x5, not 1x4. Further, your function must return a vector of length 4, not 3. Further, the first o...

2 years ago | 0

Answered
plot() and fplot() give different results for the same function
x = linspace(0, 100, 10000); y = 2*sqrt(1+x)+sin(sqrt(pi)*x).*sin(sqrt(1+x)*pi).*(2*x+1)./sqrt(x) - 2*sqrt(1+x).*cos(sqrt(x)*pi...

2 years ago | 0

Answered
Vpasolve can not find a solution that I know it exist
Maybe it must read Eq2 = ((a21*W2)/(c2*(a21+a22))) - x12 == 0; instead of Eq2 = ((a12*W2)/(c2*(a21+a22))) - x12 == 0; ? c...

2 years ago | 0

| accepted

Answered
How to build a graph of the solution of a second-order differential equation in MATLAB
Since sin(pi) = 0, your differential equation reduces to y'' + y = 0 with general solution a*sin(t) + b*cos(t) Now incorpor...

2 years ago | 1

Load more