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

Answered
Error with ode45 in line 89. Trying to use ode 45 to give data on a 4x4 state space matrix
M1=1; M2=1; K1=2; K2=2; B1=1; B2=1; x1_0=1; v1_0=1; x2_0=0; v2_0=1; %% equations q0=[ x1_0 v1_0 x2_0 v2_0]; dQdt = ...

3 years ago | 0

Answered
How to use fminbnd but with multiple variables
In the case above, your objective function is separable in the optimization variables. Thus you can solve two independent proble...

3 years ago | 1

Answered
How can I obtain all possible combinations of 3 decimals whose sum equals 1, without running into memory and space issues?
If you have some time, you can try I = 0:0.001:1. Why don't you use the code from the File Exchange ? I = 0:0.01:1; n = num...

3 years ago | 0

Answered
Help creating an array with uniformly distributed random numbers (row-wise) comprised between 0 and 1, with each column having a sum of 1
https://uk.mathworks.com/matlabcentral/fileexchange/9700-random-vectors-with-fixed-sum You cannot expect the usual uniform dist...

3 years ago | 1

| accepted

Answered
How can I input sum over in function depend on time?
Never make changes in the RK4 function. Changes have to be made in the call to RK4 and in f. tstart = 0; tend = 100; dt = 0....

3 years ago | 0

| accepted

Answered
Solving stokes flow use pde toolbox
The (simplified) Navier-Stokes equations need a special numerical treatment and cannot be solved by a general-purpose code like ...

3 years ago | 2

Answered
How do i fix the error that i am getting?
Remove the semicolon behind the line pivotColumns = rrefA(:,1:end-1); execute the code and see if it makes sense to insert the...

3 years ago | 0

| accepted

Answered
try to find hessian matrix
The vector of independent variables is (x1,x2,...,xn): syms i k n = 3; x = sym('x',[1 n]) f = n*log(k) - n*log(1/n*sum(x.^k)...

3 years ago | 0

Load more