Answered
Using fmincon but converging to an infeasible point because the size of the current step is less than the value of the step size tolerance but constraints are not satisfied to
Works for me. T = 1000; %K R = 8.314; %kJ/kmol.K P = 300; %kpa in reformer Po = 100; %kpa standard conditions mair = ...

4 years ago | 0

Answered
Create the program to return the orthogonal basis and orthonormal basis
As far as I can see, you only return the orthonormal basis from the Gram Schmidt process in the matrix Q. And saving the norms ...

4 years ago | 1

| accepted

Answered
Computing temperature of a fluid inside a cylinder using PDEPE
For comparison: R0 = .1; R1 = .15; % radii in meters t0 = 0; t1 = 1e4; % time limits wallConductivity = 150; wallDensity =...

4 years ago | 0

Answered
Fitting experimental data with experimental references
w = [Yls,Yhs,Y3]\Yt if Yls, Yhs, Y3 and Yt are column vectors of the same size.

4 years ago | 0

| accepted

Answered
How to determine an y value at a specific x value?
sm1 = v1.*N.*L1.*R./(4.*W1.*(L1./C).^2) gives W1 = v1.*N.*L1.*R./(4.*sm1.*(L1./C).^2)

4 years ago | 0

Answered
isqnonlin: compute part of objective function outside of matlab
Then call "lsqnonlin" as p0 = ...; % initial guess for the vector of material parameters sol = lsqnonlin(@(p)fun(p,y),p0) a...

4 years ago | 0

| accepted

Answered
Using function handles in a ODE function
x, L, M, V, xlow, xhigh are not given. function y = acceleromet(x) wdwdx = @(t) -6*(x(1)*t.^3 + x(2)*t.^2 + x(3)*t + x(4))*(3*...

4 years ago | 0

| accepted

Answered
finite difference method evaluation
As you can see from the two equations you wrote down, each equation gives two new unknowns. Thus in the end, you have N equatio...

4 years ago | 0

Answered
Infinite sum with Bessel's function
n = 60; sstep = 1; a_k = J0ROOTS(n,sstep); r = (0:0.01:1).'; t = 0:0.1:1; S = zeros(numel(r),numel(t)); for i = 1:numel(t)...

4 years ago | 3

| accepted

Answered
Use matlab to write code to calculate fluid dynamic problem
https://www.engineersedge.com/fluid_flow/pressure_drop/pressure_drop.htm

4 years ago | 0

Answered
"Index in position 2 exceeds array bounds (must not exceed 1)"
P, E and K are (4x1) arrays. In the loop assignment L(m,t) = P(m,t)+E(m,t)-E(m,t-1)+K(m,t)-K(m,t-1); you treat the arrays as ...

4 years ago | 0

| accepted

Answered
How to use vector value in equation?
You mean d0 = fun1(g0,a) ?

4 years ago | 0

| accepted

Answered
Solve system for Roots of Bessel Function
This is a very empirical code for your problem. Success is not guaranteed in all cases. T = 10; B = 1; K = 0.5; fun = @(a,b)...

4 years ago | 0

| accepted

Answered
Computing temperature of a fluid inside a cylinder using PDEPE
Therefore, it can be considered that , Tdot = -2*h*(T-Tw)/(rho*cp*R0) where T is the the fluid temperature inside the cylinder a...

4 years ago | 0

Answered
How to get the time step used in PDEPE solver?
pdepe uses ode15s as solver for the arising differential equations. This solver uses adaptive time stepping - thus if the probl...

4 years ago | 1

Answered
How to calculate an exact solution: non-linear equation with multiple variables
Use "eig", not "fsolve".

4 years ago | 1

| accepted

Answered
Solve system for Roots of Bessel Function
I don't know how the (an,bn) for your problem are enumerated, but maybe it's a start. At least I can assure you that you will n...

4 years ago | 1

Answered
fractional derivative of Ln(x) ?
% Sample log between 1 and 4 h = 0.01; t = 1:h:4; y = log(t); % Compute fractional derivatives with different orders orde...

4 years ago | 1

| accepted

Answered
Nonlinear constraint on optimization using ODE - system state involved
I guess you have a time vector for which you have your data vector of measurements "yexp" ? In nlincon, with these measurement ...

4 years ago | 1

| accepted

Answered
fmincon nonlinear inequality constraint
It is not guaranteed that the "test parameters" betas satisfy the constraints in each iteration of the optimization process. So...

4 years ago | 1

Answered
How to calculate dx/dt in Matlab
If your results from the theoretical equation for K_la and from the numerical formula don't correspond, it's indicating that the...

4 years ago | 0

Answered
Uniform Random Variable Generator
https://de.mathworks.com/help/stats/prob.normaldistribution.truncate.html

4 years ago | 0

| accepted

Answered
Hello helper, I'm trying to run this code (energy optimization), but i get an error message :Index in position 1 exceeds array bounds (must not exceed 1).
You use P, E, K, Em and Km as 2-dimensional arrays, but they are only scalar values. Thus all of your if-statements and referenc...

4 years ago | 0

| accepted

Answered
max value of a function
syms x func = exp(-(x - 1)^2) + exp(-(x + 2)^2); dfunc = diff(func,x); ddfunc = diff(dfunc,x); xc= double(vpasolve(dfunc==0,...

4 years ago | 1

Answered
Value of infinite integral is different
syms k S = k^3*(1+2.35*k^(2/3)); J = int(S,k) J1 = subs(J,k,Inf) J2 = subs(J,k,sym('1000000000000000000000000000000000000000...

4 years ago | 0

Answered
how to store the value of intersection points from fzero into a vector
Before using fzero or fsolve, you should check whether fun1 - fun2 really has a zero. To do this, uncomment the lines u=[0.01...

4 years ago | 0

| accepted

Answered
Is there a way to substitute a set of variables to become a new variable?
syms a b alpha_1 alpha_2 v1 v2 l P V k R alpha_1 = 2*v1/l; alpha_2 = 2*v2/l; R = P*a*b/(2*k); L1 = R*V^2*l*alpha_1*k; L2 = ...

4 years ago | 0

Answered
evaluating functions and plotting
Use "piecewise" if you want to work with symbolic variables and functions. Otherwise f = @(x)2*x.^2.*(x>0 &x<=1) + (x.^2+3).*(...

4 years ago | 0

| accepted

Answered
How to plot the solution?
syms L lags e = exp(sym(1)); k1 = 3; k_1 = 1; k2 = 2.5; k3 = 1; k_3 = 1; k4 = 2; k5 = 1; E1 = 1; E2 = 2; K1 = (k_1+k2...

4 years ago | 0

| accepted

Answered
How to find all possible 8x8 submatrices of a 13x8 matrix?
r = nchoosek(1:13,8); A = rand(13,8); for i = 1:size(r,1) B(:,:,i) = A(r(i,:),:); end size(B)

4 years ago | 1

| accepted

Load more