Risposto
how to get a good estimate of the positive parameters that will give a good fit of the curves to real data?
You should avoid defining the same data, parameters and variable definitions multiple times in your code (specific_data, gamma, ...

17 giorni fa | 1

| accettato

Risposto
How can I find a unique solution within tolerance using solve?
As long as rank(A) equals 3 in the below code, your system of linear equations has a unique solution. syms Rx Risop Rison V1=2...

18 giorni fa | 0

Risposto
function must return a column vector
Allocate dy as a column vector before assigning values to it: %Ordinary differential equation dy = zeros(4,1); dy(1)=alpha*(1...

18 giorni fa | 0

Risposto
I'm having trouble solving a system of nonlinear equations with the fmincon function.
Use % Options for fmincon options = optimoptions('fmincon', 'Algorithm', 'interior-point', 'Display', 'off','ConstraintToleran...

19 giorni fa | 0

| accettato

Risposto
Simulation - number of samples
Is there a preset (optimum) value and how is this determined? As big as necessary and as small as possible. You will have to te...

19 giorni fa | 1

| accettato

Risposto
Need help with homework.
Note that the name of the German physician was Fahrenheit, not Farenheit. % prompt for user to choose which conversion chosen_...

20 giorni fa | 0

Risposto
Weird bugs when solving three coupled second order differential equations using ode45
syms x1(t) x2(t) y(t) t0 = [0 1]; % y0 must be given in the order as prescribed by S (see below), thus % y0 = (x2(0),dx2/dt(0...

20 giorni fa | 0

| accettato

Risposto
Bessel function has problems in converting symbolic function into handle function.
It works for the numerical "besselj" function. Its derivative is given here: https://uk.mathworks.com/matlabcentral/answers/93...

20 giorni fa | 0

| accettato

Risposto
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,...

20 giorni fa | 0

Risposto
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...

20 giorni fa | 1

| accettato

Risposto
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...

20 giorni fa | 0

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

21 giorni fa | 0

Risposto
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...

21 giorni fa | 0

| accettato

Risposto
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...

21 giorni fa | 0

Risposto
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...

21 giorni fa | 0

| accettato

Risposto
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...

21 giorni fa | 1

| accettato

Risposto
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) ...

22 giorni fa | 1

Risposto
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'.

23 giorni fa | 0

Risposto
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]; ...

25 giorni fa | 1

Risposto
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...

25 giorni fa | 0

| accettato

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

25 giorni fa | 1

Risposto
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...

26 giorni fa | 0

| accettato

Risposto
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...

27 giorni fa | 0

| accettato

Risposto
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.

27 giorni fa | 1

Risposto
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...

27 giorni fa | 1

Risposto
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...

28 giorni fa | 0

Risposto
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....

29 giorni fa | 0

| accettato

Risposto
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...

30 giorni fa | 0

Risposto
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 = ...

circa un mese fa | 0

Risposto
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...

circa un mese fa | 1

| accettato