Bessel function has problems in converting symbolic function into handle function.
This code seems to work. Can you show us where you encounter problems ? syms x n = 12; f = sqrt(sym(pi)/(2*x))*besselj(n+1/2,...

15 days ago | 0

optimization expression includes an integration
c = optimvar("c",1,1,'Type','continuous','LowerBound',0.1,'UpperBound',10); g1 = @(x,c) exp(-0.5*(x./c).^2)./sqrt(2*pi*c^2); o...

15 days ago | 1

| accepted

How can I clear an error "The expression to the left of the equals sign is not a valid target for an assignment?"
You have seven differential equations, but you only specify six boundary conditions. That's mathematically incorrect. plot_velo...

15 days ago | 0

I am getting an error
Do you want to overwrite the MATLAB function "convolution1dLayer" by your own function ? function output = convolution1dLayer(i...

15 days ago | 0

Why does this code give error?
Force the array ix1 to be of the same length as ix by explicitly allocating it with the size of ix: % Run the GBO algorithm...

15 days ago | 0

| accepted

Problem Using the Median Function with Complex Numbers
c = a + (b-a)/2; k = (sign(a) ~= sign(b)) | isinf(a) | isinf(b); c(k) = (a(k)+b(k))/2; But in every case, you set...

16 days ago | 0

issue with fmincon function.
I guess the objective function should read obj_fun = @(x) -(Nup - Nt) / Nup * sum(log2(1 + x(1:Ns) ./ (sigma2 * (vecnorm(reshap...

16 days ago | 0

| accepted

Index in position 1 exceeds array bounds. Index must not exceed 18.
data = (EEG.icaweights(opt.component,:)*EEG.icasphere)*data(EEG.icachansind,:); You are aware that you overwrite the matrix "da...

16 days ago | 1

| accepted

How do I construct matrices of multiple variables and plot a graph
tspan=[0 3]; x0=100; y0=0; z0=[x0;y0]; [tSol, zSol]=ode45(@odefun,tspan,z0); plot(tSol, zSol); function dzdt=odefun(t,z) ...

17 days ago | 1

I don't know what this means
Most probably, you don't have write permission in the directory to which you want to unzip 'MerchData.zip'.

17 days ago | 0

Coupled ODEs by ode45 and could not get the figures
% Initial conditions Y0 = [298; 0.75; 0.04; 0.015; 0.0331; 0]; % [T0; Xa0; Xc0; Xs0; Z0; Soc0] % Time span tspan = [0 3000]; ...

20 days ago | 1

Can integral2 left a variable inside?
@Guan Hao You cannot simply remove the w in your expression as suggested by @Umar. I'd do the general integration first and the...

20 days ago | 0

| accepted

A numerical calculation problem leading to Inf or NaN in matlab
log2(norm(x,lambda)) does not work ?

20 days ago | 1

Hello all, kindly, I have question , how can I get the piecewise function of this blood flow rate shown below using Matlab
T = 0.56; A = 220; fun = @(x)A*sin(2*pi*x/T).*(x>=0 & x<=T/2) + 0*(x>T/2 & x <=0.7); F = @(x)fun(mod(x,0.7)); x = linspace(0...

20 days ago | 0

| accepted

calling function from separate document for fitting
However, when I try to call script 1 from 2, I get a ton of error messages. Could I please ask why is this the problem? You ca...

22 days ago | 0

| accepted

Setting bounds for constants in a fit() object in terms of other constants in the fit object
Use "lsqcurvefit" and set A(1,2) = -1, A(1,3) = 1/min(x) and b(1) = 0 for the linear constraint condition A*x<=b.

22 days ago | 1

How store evolution of x over the iterations of lsqnonlin?
If you can't use the nested approach, define "history" as a persistent variable and call "myoutput" after the computation has fi...

22 days ago | 1

Something doesn't work for me in fit
hist_x=[10 30 50 70 90 110 130 150 170 190 210 230 250,... 270 290 310 330 350 370 3...

22 days ago | 0

simplify and reorganize symbolic expression
The only symbolic function that comes to mind is "coeffs". If this function does not do what you want, I fear you are lost here....

24 days ago | 0

| accepted

help with bvp4c error
Use solinit = bvpinit(x_init,[1 1 phi_c 0]); instead of solinit = bvpinit(x_init,[1 1 phi_c 0],w); Why did you use the w-pa...

25 days ago | 0

Index in position 1 is invalid. Array indices must be positive integers or logical values Error
Array indexing in MATLAB starts with 1, not with 0. But you try to set Pdata(0)=pressure01(0,1); in your nested loop for i = ...

25 days ago | 0

Is this a correct way to use fsolve?
Solve in w^2 instead of w - then there shouldn't be imaginary parts in the solution: F = @(w) ((1-p)/C)*(kappa^q - (w^2)^q)+y+z...

25 days ago | 1

| accepted

Performing Newton's divided difference and trapezoidal rule in one program
I don't know if this is what you want. Your code is very badly structured and hard to follow. Shouldn't x=[2 4 6 8 10 12 14 1...

26 days ago | 0

| accepted

why am I getting this difference in the plotting?
Your choice of a and b must be different from the values you posted: % First method a = 3; b = 0.9; x0 = 0.9; y0 = 1-x0; f...

27 days ago | 0

| accepted

help solving for Delx
qf = 38.6; T1 = 25; e=0.95; s=5.67e-8; K=300; t=0.12; w=3; fun = @(T,delx) [T(1)-T1; qf - K*w*t/delx*(T(1)-T(2)) - 2...

28 days ago | 0

| accepted

problem doing implicit plotting
Remove the dot at the end of the expression x.*y.

28 days ago | 1

Why i am getting blank graph? Can someone help me to figure out error in my code.
is_exam3() function is_exam3 L=0.01; M=0; q=0.5; a=0.03; Pr=0.1; b=0.2; p=0.1; m=0.1; e=1.0; H=0.1; E=0.1; o=0...

28 days ago | 0

How to solve the following PDE equation
I think you mean x(s,0) = 10 instead of x(s,t) = 10, don't you ? The easiest way to solve the equation is to discretize the exp...

29 days ago | 0

| accepted