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

Answered
how to check if two symbolic fractions are the same?
syms x y z fraction1 = (x+y)/(x*y) + z; fraction2 = (x+y+x*y*z)/(x*y); isAlways(fraction1==fraction2)

3 years ago | 1

| accepted

Answered
Problem when using pdepe with time dependant and nonconsistent boundary conditions
If you specify the gradients of the solution variables as boundary conditions (as you do in your boundary function), you cannot ...

3 years ago | 0

Answered
Computing expint(x), where x is an array, locks up for some x but not others that are very similar
The computation of the second column is even faster. I wonder how matlab evaluates expint(x) if x is a vector different from eva...

3 years ago | 0

Answered
Error L2 is not defined
Since g does not depend on w and f does not depend on z, the equations are not coupled and you can do it in the following manner...

3 years ago | 0

Answered
Problems in finding a set of global minima
L=1; L1=L/6; omega0 = 0; omegaR = 10; tR= (2*pi)/omegaR; te = 0.8; t1 = 0; t_i = te/50; gamma_i = 1; %alpha = (t_i^2)/...

3 years ago | 1

Answered
NaN computed by model function, fitting cannot continue. Try using or tightening upper and lower bounds on coefficients.
a11 and a12 must be such that a11*C1 + a12*C2 > 0. Otherwise, the operation ^(n1-1) gives a complex result. The simplest exampl...

3 years ago | 0

Answered
Skipping Iterations in a For Loop
FEM = [-16 16 -18 12 -6 6]; n = numel(FEM); for i = 1:n-3 FEM(i+1) + FEM(i) end FEM(end) + FEM(end-1)

3 years ago | 0

Answered
Finding Extremum of Multivariate Functions
R(1,2)=0.7844; R(1,3)=0.7844; R(2,2)=0.6202; R(2,3)=-0.2021; R(3,3)=0.5864; x0 = 0.5*ones(10,1); lb = -1*ones(10,1); ub ...

3 years ago | 1

| accepted

Answered
Problem in solving a Fokker-Planck equation
The order of your loops is wrong. Try Nx=100;Ny=100;Nt=1000; xmin=0;xmax=3; ymin=0;ymax=3; dx=(xmax-xmin)/(Nx-1); dy=(ymax-...

3 years ago | 0

| accepted

Answered
What is the difference between "no feasible solution found" and "the problem is infeasible" messages in LSQLIN?
"No feasible solution found" means: there might be a feasible solution for your problem, but I was not able to find it. But I gi...

3 years ago | 1

| accepted

Answered
Strange temperature output for 2D heat equation
% Material properties rho=7850; Lambda=50; cp=477; alpha=Lambda/(rho*cp); % Geometry and mesh L = 0.1; nx = 10; ny = n...

3 years ago | 1

| accepted

Answered
Getting very large numbers for solutions of a system of equation
syms x y z q r theta_0 = 0; beta = 0.5; U=exp(2*i*theta_0); eqn1 = (U*beta*besselj(0,2)-1)*x + (U*beta*besselj(1,2))*y + (...

3 years ago | 0

| accepted

Answered
error in running my optimization code
I assume that "yexpected" is a matrix of size 49x3. yexpected=table2array(Book65); p0 = [3 25 25 12 1 0.5 1]; sol = lsqnonlin...

3 years ago | 0

Answered
How can to compute the following case?
D = load("D.mat"); D = D.D; n = size(D,1); m = size(D,2); distance = zeros(n,m,n,m); for i=1:n for j=1:m ...

3 years ago | 1

| accepted

Answered
Plot a nx2 matrix as points
A=[0.5 2; 1.0 -0.8; 1.5 -2.5]; plot(A(:,1),A(:,2),'o')

3 years ago | 0

| accepted

Answered
Solve two equations for one variable
syms P_st vdq_st_abs Vabs delta_st Vangle Xg Q_st real eq1 = P_st - vdq_st_abs * Vabs * sin(delta_st - Vangle) / Xg == 0; eq2 ...

3 years ago | 0

Answered
non linear regression problem. fitnlm gives error
Look at the values of K and B. Do you really want to approximate B by a*K^b ? format long K = load("FITDATAK.mat"); K = K.FIT...

3 years ago | 0

| accepted

Answered
Am I doing thid correct. pdepe function
x = 0:0.1:1; t = 0:0.05:0.5; m = 0; u = pdepe(m,@PDEeqn1,@initial1,@bc1,x,t); plot(x,[u(1,:);u(2,:);u(3,:);u(4,:);u(end,:)])...

3 years ago | 0

Answered
How to solve coupled systems of PDEs and ODEs using method of lines
http://www.scholarpedia.org/article/Method_of_lines/example_implementation https://www.sciencedirect.com/science/article/abs/pi...

3 years ago | 0

Answered
integral2 for a non-scalar matlabFunction
"intagrand_temp" is a 5x3 matrix of symbolic functions in eta and zi. I don't understand which scalar-valued function(s) you wan...

3 years ago | 1

Answered
How to check the degree of parallelism
The intersection of P1 and P2 is given by x = origin1 + directions1*lambda the intersection of P1 and P3 is given by x = orig...

3 years ago | 1

Answered
Hi i have created a code for adsorption process breakthrough curve following one of the examples, however i still have some orange cations around please help
You solve in q, not in qstar. Thus q=y(Nz+1:2*Nz); instead of qstar=y(Nz+1:2*Nz); Further, I doubt that qstar(i)=qm.*ks.*c...

3 years ago | 0

Load more