Answered
nonconformant arguments (op1 is 1x1, op2 is 0x0)?
Works for me (see above). Although the solver doesn't seem to be successful. You forgot to include the "global" line in the scr...

3 years ago | 1

| accepted

Answered
Get the same value when using Integral2 function
As I already tried to explain, v_induced and v_slipstream are only formal parameters for the integral2 function. They cannot tra...

3 years ago | 0

| accepted

Answered
Adding 2D array to 3D array within loop
totalarray = rand(365,721,1440); newdata = rand(721,1440); squeeze(totalarray(1,:,:)) newdata for i = 1:365 totalarray(...

3 years ago | 0

| accepted

Answered
the value i am calling for from a matrix isnt changing although index is changing
You forgot to reset e to 1 after the while-loop.

3 years ago | 0

| accepted

Answered
Error of "Integrand output size does not match the input size."
As written, Oper.rho .* (v_induced ./ Oper.Vinf) .* 0.5 .* (Oper.Vinf^2 - (v_induced .^2)); and Oper.rho .* (v_slipstream ./ ...

3 years ago | 1

Answered
Not able to get real solution through syst solve
Always plot the functions before solving for common points and set initial values for the variables according to what you see in...

3 years ago | 0

Answered
Fixed bed adsorption using pore diffusion model
The "dq/dt" in equation 2 is the change of mass of q in the particle with respect to time. If you set q_in_particle = integral_...

3 years ago | 0

| accepted

Answered
Solve integral equation efficiently
nu = 1.04 * 10^(-6); %m2/s Aplus = 26; kappa = 0.41; z = 0.3; meanU = 4.3556e-04; fun = @(x) 2 ./ ( 1 + sqrt( 1 + 4 * kap...

3 years ago | 1

| accepted

Answered
How to use a sparse Jacobian for a stiff ODE solver to avoid the error "array exceeds maximum array size preference"
Here is an example code how to create the sparsity pattern for a given (quite complicated) ODE function. Use the function "S_pa...

3 years ago | 0

Answered
How to use "deval" or any other function non ode solver output
Y_exact_to_Y = interp1(T_exact,Y_exact,tout) where T_exact is the vector of time points corresponding to Y_exact. Further, you...

3 years ago | 0

| accepted

Answered
How to Solve PDE numerically that gives boundary condition on function at one end and on slope of function at other end?
a = 1; p = 1; w = 1; r0 = 0.5; rstart = 0; rend = 1; nr = 50; zstart = 0; zend = 1; nz = 50; ...

3 years ago | 1

| accepted

Answered
How can I solve the differential equation whose variables are y"(i), y"(i+1)?
Use dde23. But often, such dependencies of the ODE from the results of the last time step stem from a discretization of the dif...

3 years ago | 0

Answered
Maximizing Batch Reactor Products in matlab
You get almost identical values for the optimal T, C_M and C_TEA for all x-values in between 17 and 45 as you can see after the ...

3 years ago | 1

| accepted

Answered
Using a symsum inside a fsolve
If I understood correctly, I would have to run a Symsum "nested" inside the fsolve. Is that correct? How do I implement this? ...

3 years ago | 0

Answered
Maximizing Batch Reactor Products in matlab
max_value = -Inf; T_array = linspace(338.15,368.15,10); C_M_array = linspace(1,100,10); C_TEA_array = linspace(1,200,10); C_...

3 years ago | 0

Answered
How to Interpolate an entire data set
I think you interchanged latitude and longitude in your call. It should be Anew= F(-6.00,52.00); instead of Anew= F(52.00,-6....

3 years ago | 0

Answered
Which triangulation Method is used for natural scattered interpolation?
Taken from https://uk.mathworks.com/help/matlab/ref/scatteredinterpolant.html Algorithms scatteredInterpolant uses a Delaunay...

3 years ago | 0

Answered
Why is it detecting 2 centroids in 1 object?
Are you sure you included the correct image file ? I = load("labelstemp.mat"); I = I.labelstemp; size(I,1)*size(I,2) nnz(I(:...

3 years ago | 0

Answered
Indexing nearest value to my coordinate
lon_data = rand(621,837); lat_data = rand(621,837); stations = rand(59,2); lon_indices = zeros(59, 1); lat_indices = zeros(5...

3 years ago | 0

| accepted

Answered
HOW TO: Using each step result in subsequent step during integration via ODE
All variables needed to compute p(t) are part of the solution vector x which is input to "gearCH". So I don't see the problem to...

3 years ago | 0

Answered
How to Solve PDE numerically that gives boundary condition on function at one end and on slope of function at other end?
This is the stationary 2d Laplace equation. It cannot be solved by a 1d-solver like pdepe. You will have to discretize the PDE...

3 years ago | 0

Answered
Programming error with a model function
If your system of differential equations really reads y1' = y2' y2 = A/B * t * y1 it follows y2' = A/B * y1 + A/B * t * y1' ...

3 years ago | 1

| accepted

Answered
Using of symprod fuction
Nv=[0 5 1 17 4 8 9]; Nb=[1 1 1 1 1 1 1]; Sb=[25 28 32 36 35 38 0]; n = numel(Nv); % Easy to follow Z = 0; for i = 1:n-1 ...

3 years ago | 1

| accepted

Answered
Network adjacency matrix for connecting n node with probability p
clc; clear all n=10; p=0.4; adj_matrix = generate_adjacency_matrix(n, p) (nnz(adj_matrix(:))-n)/(n^2-n) function adj_matri...

3 years ago | 0

Answered
Solving two exponential equations
syms T eqn = 5/19*(5021747384670633/8796093022208 - (191*exp(-609699130650934272/(622444614725399*T)))/10) ==... 5/27*(3...

3 years ago | 1

Answered
System of PDE-ODE with multi point boundary conditions- How to can i solve it?
% Set physical parameters L = [160 10 25 10 160]*1e-6; % [m] MEA layer thicknesses kt = [1.6 0.27 0.3 0.27 1.6]; % [W/mK] Ther...

3 years ago | 0

| accepted

Answered
Plotting two non linear equations in same graph
t= linspace(0,1); y= linspace(0.5,1); [T, Y] = meshgrid(t, y); f1 = @(t,y)(y - ((t.^8 - 8*t.^7 + 36*t.^6 - 96*t.^5 + 146*t.^4...

3 years ago | 3

| accepted

Answered
Solve symbolic equation in order to get parameters of an equation
syms phi(t) p(t) syms R L K J V b phi0 p0 real eqn1 = diff(phi,t) == -R/L * phi - K/J * p + V; eqn2 = diff(p,t) == K/L * phi ...

3 years ago | 0

Answered
Failing parameter estimation using fmincon. Objective function is undefined at initial point.
Before calling fmincon, add the line objective_function(p_initial) and see what your function returns. My guess is Inf or NaN...

3 years ago | 2

| accepted

Answered
Converting probability distribution plot into a histogram
Use https://uk.mathworks.com/help/stats/gprnd.html to compute random numbers from the Pareto Distribution if you know its para...

3 years ago | 0

Load more