Answered
How can I plot the graph for this function?
m = 100; h = @(x) x.^2+1; x = 0:0.01:10.0; tol = 1e-16; for i = 1:numel(x) Lm(i) = fun_Lm(m,h,x(i),tol); end plot(x,L...

4 years ago | 1

| accepted

Answered
(Matrix Optimization) Optimization method for coefficient matrix in Ax = b with known x and b.
If you have two 4x1 data vectors x and b to estimate A, you have 8 equations in 16 unknowns. This system is underdetermined - y...

4 years ago | 1

Answered
Using the Hessian Matrix to Determine the Nature of a Turning Point
If you mean the kind of extremum: syms x y = x^2; dy = diff(y,x); ddy = diff(dy,x); sol = solve(dy==0); ddy_at_critical_po...

4 years ago | 0

Answered
i have an error about the general solution. it says that it's not found in the code
syms A(t) k eqn = diff(A,t) == k*A; cond = A(0) == 5000; S = dsolve(eqn,cond); k_num = solve(subs(S,t,650)==2500,k); S_num ...

4 years ago | 0

Answered
MATLAB precision (?) error that escalates to infinity
Your iteration diverges. Both mu2 and MU2 contain numbers in the order of 1e165 for iter = max_iters. So you shouldn't worry ...

4 years ago | 0

| accepted

Answered
I have to write a code with using these formulas. (Gama=1.4 M1=3.4) Then I have to reach p02/p01~= 1. So beta in the code should be changable. At the end M2 will also found
fun = @(beta,p02divp01,M1,gamma)p02divp01-((gamma+1)*M1.^2.*sin(beta).^2./... (2+(gamma-1)*M1.^2.*sin(beta).^2)).^(gamma...

4 years ago | 0

| accepted

Answered
How can I find all possible pairs within a range that result in the same average?
Do you know if there's any way that this can be done by just using for loops and nested for loops with if statements to get the ...

4 years ago | 1

| accepted

Answered
Sorting coordinates on radial distance from origin
If (x0,y0) is the reference point and your coordinates are saved in a matrix XY of size (2xn), then just use R = 2.0; %e.g. ...

4 years ago | 0

| accepted

Answered
Solving partial differential equations using pdepe solver
Some people say, one can take pdepe for this kind of problem (e.g. Bill Greene), I'd say one shouldn't because it's problematic....

4 years ago | 0

| accepted

Answered
Cannot get a non-singular matrix
Maybe of help: The Vandermonde matrix is ill conditioned ! Maybe of help: f = @(x) log(exp(x) + 1) + 2 * sin(x); a1 = 1; b1 ...

4 years ago | 0

Answered
how to solve non linear system of equations with variable coefficients in matlab
You might first try if a symbolic solution exists: syms a b c d e f g h m n u v w x y z eq1=a-(b*z*x)/(c + x)-d*x == 0; eq2=e...

4 years ago | 0

Answered
I have two implicit functions as f1(x,y1)=0 and f2(x,y2)=0. Is there any possible way to plot y1/y2 vs x?
f1 = @(x,y1) ...; % insert f1 f2 = @(x,y2) ...; % insert f2 f = @(y) [f1(x,y(1)),f2(x,y(2))] X = 0:0.1:1; % you...

4 years ago | 0

| accepted

Answered
I want to plot region for z numbers that satisfy D<10^-4.
R1 = @(x,y)- 0.0000000000000042786173933199698996786792332228*(x+1i*y).^16 + 0.000000000000093679201874795131075154866430805*(x+...

4 years ago | 0

| accepted

Answered
Finite difference method used non-linear algebraic equations to be solved by Newton-Raphson methods.
Your function "anucyl_01" produces many NaN values - time to debug. Why don't you use an ODE solver instead, e.g. bvp4c ? alp=...

4 years ago | 0

Answered
Why my graph not same as research paper?
Sometimes it's better to start anew: x=(0:0.1:10).'; C0 = 1.0; tt = [5.0,10.0,15,0]; u0 = 0.25; D0 = 0.45; m = 0.1; gamma...

4 years ago | 1

| accepted

Answered
Cartesian product of 2 matrices
m = 4; justRows = dec2bin(0:2^m-1)-'0'; n = size(justRows,1); M = cell(2^m,1); for i = 1:n A = reshape(justRows(i,:),[s...

4 years ago | 0

Answered
Product calculation between two matrixes
X_QPSK = repmat(X_QPSK,1,400); Range_compression=surv_matrix.*conj(X_QPSK); .* multiplies each element of surv_matrix with eac...

4 years ago | 0

| accepted

Answered
How to find x value for certain y value of a lineplot in matlab
EV = EV(5:14); P = P(5:14); EV_05 = interp1(P,EV,0.5)

4 years ago | 2

| accepted

Answered
Integration takes time too long
X=-2:0.1:6; y=0.4; t=0.75; v=1.5; alpha=0.1; for i=1:numel(X) x = X(i); Fun = @(r)fun(r,x,y,t,v,alpha); C(i)...

4 years ago | 0

| accepted

Answered
Numerical simulation with symbolic expressions
syms gamma alpha b expr = gamma^2*alpha + log(b); expr = matlabFunction(expr,'Vars',[gamma alpha b]); gamma = 0:0.1:1; alpha...

4 years ago | 0

Answered
Curve fitting of transcendental equation with lsqcurvefit
Xdata=GWM_viscosity'; Ydata=GWM_f_out'; predictedzeros = @(x) Ydata + sqrt(k_val)./sqrt(m_canti_val+x(2)*B_val*Gap_val*L_val...

4 years ago | 0

| accepted

Answered
How to introduce a constraint and stop condition in ode45 ?
First question: You can't prescribe a constraint for a solution variable of an ODE. The ODE variable results automatically from...

4 years ago | 2

| accepted

Answered
Array Operations give me a constant
D0 = 100; D1 = 80; D2 = 80; HD = 0.4; A = -6.96*log(D1/D2)/D0; % A is 0 for symmetric bifurcations B = 1 + 6.98*(1-HD)/D0; ...

4 years ago | 0

| accepted

Answered
simplifying an algebraic expression in 6 variables
fun = @(x) sum( (y - A.'*x - K*sqrt((B.'*x).^2 + (C.'*x).^2) ).^2 ); Aeq = ones(1,6); beq = 1; lb = zeros(1,6); ub = ones(1,...

4 years ago | 0

| accepted

Answered
Solving the linear equation
M = T*P.'*inv(P*P.') is the least-squares solution. But you cannot expect that T=M*P is exactly satisfied.

4 years ago | 0

Answered
Implementing vectorial equation with matrix as variable
c^(D*i) is a 2x2 matrix. Thus [a0;b0]*c^(D*i) is not defined. Maybe you mean c^(D*i)*[a0;b0] or [a0,b0]*c^(D*i) ? I implemented...

4 years ago | 0

| accepted

Answered
Finding the index of elements of a vector in a mesh quite fast
mesh=linspace(0,10,10^6); A=0+(10-0).*rand(1,10000); N=1000; tic; for n=1:N y = discretize(A,mesh); idx = A-mesh(y) ...

4 years ago | 0

| accepted

Answered
Curve Fitting Toolbox with multiple variables
lsqnonlin and lsqcurvefit allow to prescribe lower and upper bounds (lb,ub) on the parameters: x = lsqnonlin(fun,x0,lb,ub,optio...

4 years ago | 1

| accepted

Answered
How can I change this code to euler backward method? (implicit method)
f = @(t,y) -100000*y + 99999*exp(-t); t0 = 0; y0 =0; h = 0.01; tn = 2; n = (tn-t0)/h; t(1)=t0; y(1)=y0; ...

4 years ago | 0

| accepted

Answered
Something wrong in the plotting
Only the continuous line is visible in Release R2022a. V1 = @(r,w) -acosh(10*(w./(1600*r + 21)).^(1/2))/20000000000; V2 = @(r,...

4 years ago | 0

Load more