Answered
problem of 2d PDE animation
g = 'squareg'; b = 'squareb3'; c=1;d=1;a=0;f=0; [p,e,t]=initmesh(g); x=p(1,:).';y=p(2,:).'; u0=atan(cos(pi*x)); ut0 = sin(...

30 days ago | 0

| accepted

Answered
Error With Least Squares Approximation
Besides the fact that it's numerical nonsense to fit a polynomial of degree 20 to data: What do you get if you simply use coef...

1 month ago | 0

Answered
Failure in initial nonlinear constraint function evaluation. FMINCON cannot continue.
Most probably you mean c(i) = -(((X(i) - x_curr)/sqrt((X(i) - x_curr)^2 + (X(i+n) - y_curr)^2 )) * X(i + 3*n) + ((X...

1 month ago | 0

Answered
Initial Conditions for Newton Raphson Method for 9 equations 9 unknowns problem set
It's the same behaviour with "fsolve", MATLAB's nonlinear solver. The seven equation problem is solved without problems, and th...

1 month ago | 0

Answered
How to assign outputs of a function to an anonymous function in order to optimize with lsqcurvefit
What hinders you from using the usual coding like this ? % test data xdata = ... [0.9 1.5 13.8 19.8 24.1 28.2 35.2 60.3 74.6...

1 month ago | 1

Answered
This is a macroeconomic expression under the topic of real rigidities in long run
syms W_i P nu L n m p sigma real omega = (W_i/P-nu)*L/n*(m^p*W_i/p)^sigma simplify(diff(omega,W_i))

1 month ago | 0

Answered
intergration of function failed to calculate
syms X1 a0 a1 a2 a3 a4 a5 a6 L EI yApprox = a0 + a1*X1 + a2*X1^2 + a3*X1^3+ a4*X1^4 + a5*X1^5 + a6*X1^6; y1Approx= diff(yApp...

1 month ago | 0

| accepted

Answered
Chemical reaction model in accompany with CFD in Matlab
MATLAB is not the suitable tool to solve CFD problems. Use ANSYS or something similar for this. Usually, these tools already hav...

1 month ago | 1

Answered
matlab guide for Calculating 6 dimensional numerical integral Dosen't work
tmax in Q1 must be a scalar, not a function handle. Try "integralN": https://uk.mathworks.com/matlabcentral/fileexchange/47919...

1 month ago | 2

| accepted

Answered
Solving a system of differential equations with a variable stored in an array
This is what you get with your equations and your data for beta: T = 0:30:360; b = [0.50, 0.49, 0.45, 0.33, 0.27, 0.32, 0.37, ...

1 month ago | 0

Answered
Newton's Method on MATLAB for Stationary Solutions for the Non-linear Klein-Gordon Equation
All you see in the graphs are floating point errors. Your system of equations has solution x(i) = 0 for 1 <= i <= numBases and...

1 month ago | 0

| accepted

Answered
Defining a time-dependent boundary feature
https://uk.mathworks.com/help/pdf_doc/pde/pde.pdf Chapters: Specify Boundary Conditions > Nonconstant Boundary Conditions Sp...

1 month ago | 0

Answered
How to write a Monte Carlo Simulation?
ps = 120; pb = 30; Profit = @(q,D) ps*min(q,D)-pb*q; number_of_trials = 1000000; expected_profit = zeros(301,1); for i = 0:...

1 month ago | 0

| accepted

Answered
This is an iterative program, but the result is wrong. Why?
g = @(x) cos(x); xc = fpi(g,1,1e-6) g(xc) function xc = fpi(g,x0,tol) xold = x0; error = 2*tol; while error > tol ...

1 month ago | 0

Answered
Solving simple integro-differential equation using dsolve in Matlab
If you insert the line simplify(diff(x,t)+2*x+2*x*t) you will see that this expression turns out to be equal to 0. So MATLAB i...

1 month ago | 1

Answered
How to optimise an objective function with a summation of integrals
The support of Aeq and beq inputs was introduced in release R2023a. You should always consult the documentation relevant for yo...

1 month ago | 0

Answered
Integrating the density function of Brownian motion
Maybe it helps to resolve the integration with respect to t: syms t T real positive syms x real g = 1/sqrt(t)*exp(-x^2/t); i...

1 month ago | 0

Answered
Helmholtz problem in circular disk
According to your code, data(i,j) is a zero of besselj(j-1,x) in the interval [(i-1)*pi i*pi]. So let's plot besselj(1,x) and b...

1 month ago | 1

Answered
How to build a graph using stem for a given equation?
Since your delta function does not support array inputs, you must use something like x1=a1*arrayfun(@(n1)delta(n1-b1),n1) inst...

1 month ago | 1

Answered
How do I code a Hamiltonian Cycle in an undirected weighted graph?
I didn't test it yet, but maybe this one from the File Exchange: https://uk.mathworks.com/matlabcentral/fileexchange/51610-hami...

1 month ago | 0

Answered
Find critical points of parametric function
The critical points are solutions of a polynomial of degree 6 in z. There is no solution formula for roots of polynomials of deg...

1 month ago | 1

| accepted

Answered
Central and Forward difference schemes heat conduction for two-layer materials
heattransfer() function heattransfer xstart = 0; xend = 1; xinterface = 0.25; xmesh1 = linspace(xstart,xinterface,25); xme...

1 month ago | 0

| accepted

Answered
Average Optimization using GA or intlinprog algorithms
https://uk.mathworks.com/matlabcentral/answers/2063957-optimization-problem-with-array-input?s_tid=srchtitle

1 month ago | 0

Answered
how to ues the exponentials and derivatives in bvp4c
yp1 = deval(S,1) ym1 = deval(S,-1); T1= exp(-b1*(1+m))*ym1(4); T2= exp(-b1)*yp1(4); N1= -(1+b2*(1+m))*ym1(5); N2= -(1+b2)*y...

1 month ago | 0

| accepted

Answered
Nonlinear time dependent 2D system of PDE's
I doubt there is a software capable to handle this kind of PDE system automatically. You will have to discretize the spatial d...

1 month ago | 0

Answered
How could I have these two erros when I did everything right (otherwise)?
c_p defined in your script does not mean that it is also visible in your functions. Either define the functions as nested funct...

1 month ago | 0

Answered
Problem with solving two differential equations depending on each other
Since W0 = 0, you get Re = 0 and thus lambda = something undefined (you divide by Re !). What does the c stand for in dm^3/c fo...

1 month ago | 0

Answered
How to plot function with different first x values?
I = @(R)0.5*(R>=0 & R<10)+5/R*(R>=10 & R<=100); U = @(R)0.5*R*(R>=0 & R<10)+5*(R>=10 & R<=100); P = @(R)I(R)*U(R); R = 0:0.1:...

1 month ago | 0

| accepted

Answered
Why eigen vector looks different than the calculated one
Eigenvectors are only unique up to a multiplicative constant, and MATLAB's eigenvectors are normalized to be of norm 1: [1;-3]/...

1 month ago | 0

| accepted

Answered
Paramter optimization using fmincon
It seems that the model is not able to reproduce your measurement data. The curves look qualitatively different. clc; clear; ...

1 month ago | 0

| accepted

Load more