Answered
Simplify matrix of symbolic equations
syms x1 x2 f1 f2 f1 = x1 + x2 == 1; f2 = 2*x1 + 3*x2; x1s = solve(f1,x1); f2 = subs(f2,x1,x1s)

4 years ago | 0

Answered
Analytical solution of symbolic equation
The term L^a in eqn2 prevents that it is solvable for L. If you specify a as 1/2, 1/3, 1/4, 1, 2, 3, 4, e.g. eqn2 is a polynomi...

4 years ago | 0

| accepted

Answered
fsolve giving error that solution is not finite and real. When I test using vpasolve() I get a solution, then I input the same solution and get same error of not finite/real.
c1 = 0.5176; c2 = 116; c3 = .4; c4 = 0.4; c5 = 5; c6 =21; c7 = .08; c8 = .035; syms lambda for k = 1:600 theta = p...

4 years ago | 0

Answered
ode45 errors in integration
Try setting RelTol and AbsTol to smaller values than the defaults: options = odeset('RelTol',1e-6,'AbsTol',1e-8); [z,r] = ode4...

4 years ago | 0

| accepted

Answered
Not getting finite result
syms theta syms z K L=40; lambda=0.532*10^(-6); a=10*(lambda*L)^0.5; A=1; n=0; m=0; k=2*pi/(lambda); e =(k*a)/((k*a^2)...

4 years ago | 0

| accepted

Answered
Solving system of ODE's with one dependant algebraic equation
When executing the code, na becomes NaN relatively soon: clc; clear; %Gaussian photon pump intensity FWHM = 9; sd = 2.355*FWH...

4 years ago | 1

| accepted

Answered
Unable to perform assignment because the indices on the left side are not compatible with the size of the right side. Can anyone please help, Thanks in advance.
muo(i) = (-1./u).*log(((d1.^m)./(a.*n.*PsByN_0(i).*T.*u+d1.^m).*a)./(1-a)); instead of muo(i) = (-1./u).*log(((d1.^m)./(a.*n.*...

4 years ago | 0

| accepted

Answered
how to reduce the size of a matrix?
n = 4; A = rand(n,n); A_reduced = zeros(n/2,n/2); for i=1:n/2 for j=1:n/2 Ahelp = A(2*(i-1)+1:2*i,2*(j-1)+1:2*j...

4 years ago | 0

Answered
(Matrix Optimization) Optimization method for coefficient matrix in Ax = b with known x and b.
If x1, b1, x2, b2 are your given data, use x1 = [2 7 56 -3]; b1 = [12 -4 0.23 pi]; x2 = [-5 23 9.5 12]; b2 = [0.43 2.4 -12.6...

4 years ago | 1

| accepted

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

Load more