Answered
I am trying to solve the non-linear solver 'fsolve' to solve the rate equations. But the f(x) shows unprecedented high values and its shows no solution found.
Here is a symbolic solution of your problem. It seems to boil down to determine the roots of a polynomial of order 6. Since you ...

3 years ago | 0

| accepted

Answered
Numerically solving a diffusion equation with a piecewise initial condition
I changed V(i,j) = sum((4./(k.*pi).^2).*sin(k.*pi/2).* sin(k.*pi.*x(j)).*exp(-0.5.*t(i).*(k.*pi).^2)); to V(i,j) = sum((4./(...

3 years ago | 1

| accepted

Answered
Error in Fmincon, objective function must return scalar
F_S1 = wblpdf(d,mu_Sr1,sig_Sr1) F_S2 = wblpdf(d,mu_Sr2,sig_Sr2) F_S3 = wblpdf(d,mu_Sr3,sig_Sr3) d is a vector with six values...

3 years ago | 0

Answered
Hi all, can anyone please help to create code for the condition bellow
x = 10:20:200; y = 0.1:0.08:1; [X,Y] = meshgrid(x,y); Z = zeros(size(X)); Z(X<=60) = 8.1.*0.7.*X(X<=60); Z(X>60) = 8.1.*42;...

3 years ago | 0

| accepted

Answered
ploting of a serie
N = 53; tstart = 0.0; tend = 0.75; dt = 0.015; t= tstart:dt:tend; t = t.'; n = 0:floor(N/2); c=[0.16192008 0.05711...

3 years ago | 0

Answered
Normalization of probability distribution function
I think the kernel density is already normalized ... From the documentation: [f,xi] = ksdensity(x) returns a probability densi...

3 years ago | 2

Answered
How to use lsqnonlin with multiple constraints?
Use lb and ub in the list of inputs to "lsqnonlin".

3 years ago | 1

Answered
Error using semilogx Vectors must be the same length.
Use A=@ (w) 1./(1 -(Wb./w).^2 - 1i*2*Wb./w); instead of A=@ (w) 1./[1 -(Wb./w).^2 - 1i*2*Wb./w];

3 years ago | 0

Answered
BVP4C:error Unable to solve the collocation equation -- a singular jacobian encountered
As I said before: Remove x=0 from your interval of integration to avoid a division-by-zero. Nonetheless, bvp4c has problems wit...

3 years ago | 1

| accepted

Answered
Error in double integration
syms r ph phi lam=532*10^-9; z=100; k=2*pi/lam; omega=30; w0=0.002;m=1;rho=1;p=1; E = 1./(w0^2) + (1i*k)./(2*z); Con1=(1i...

3 years ago | 0

| accepted

Answered
How do i find the global minimum of chi^2 function of two variables?
Turn the function you want to minimize using a numerical solver like "fminunc" or "fmincon" into a function with numerical argum...

3 years ago | 0

| accepted

Answered
Solving coupled differential equations
MATLAB is not able to get a solution. Take the one from WolframAlpha: https://www.wolframalpha.com/input?i=y%27%28t%29+%3D+-f%2...

3 years ago | 0

Answered
When integrating numerically with Integral 2, the integral contains a vector, resulting in an error: Arrays have incompatible sizes for this operation.
R = 5; r = 6:0.1:9; theta = [0,pi/6,pi/4]; %A = @(r,theta,rr,phii) ((r.*sin(theta)-rr.*sin(phii)).^2+r.^2.*cos(theta).^2+rr.^...

3 years ago | 0

| accepted

Answered
Issues when stracting from an ODE 45 that depends on a derivative
yc and t are scalars, thus single values. diff(yc)/diff(t) makes no sense in this case. Simply use dyc = -2*sin(t)

3 years ago | 0

| accepted

Answered
what's wrong my code about ode model
What is Cprime ? % Define the parameter values k = 1.2; %killing rate of cancer cells by T cells r_C = 1/1.0; % Logistic grow...

3 years ago | 0

| accepted

Answered
polyfit vs csapi revolve - can't square the integral on csapi
Take a look here on how to to generate a spline function squared and integrate it: https://de.mathworks.com/matlabcentral/answe...

3 years ago | 0

Answered
How to pass an array into the initial condition function while using pdepe
However after the solution (1xn array) is achieved, i perform some other calculation and then i want to feed the end result back...

3 years ago | 0

| accepted

Answered
Why I got an error in "plot(X1,sqrt(2*g*X1)*tanh(sqrt(2*g*X1)/(2*L)*t),'o')" in the following code??
Seems you got the derivative wrong. % Constants g = 9.81; % m/s^2 v = 4; % m/s t = 3.45; % s L = 5; % m X0 = 3; % m Es = ...

3 years ago | 0

Answered
Dsolve solves differential equation with a very long output, is something wrong?
syms lambda mu real positive syms t p1(t) p2(t) p3(t) eqn1 = diff(p1,t) == -5*lambda*p1 + mu*p2; eqn2 = diff(p2,t) == 5*lambd...

3 years ago | 1

| accepted

Answered
Extracting an intermediate vector from ode45
Use s = zeros(numel(t),1); u = s; z = s; for i = 1:numel(t) [~, s(i),u(i),z(i)] = smc_obsv(t(i), x(i,:)); end instead o...

3 years ago | 0

| accepted

Answered
How to numerically solve system of equations and differential equations simultaneously?
MATLAB's ode solvers allow a mixture of differential and algebraic equations as in your case. These systems are called differen...

3 years ago | 2

Answered
Plot a quadrilateral having 8 points (each side passes through two points)
P1 = [0 0 0]; P2 = [1 0 0]; P3 = [0 1 0]; P4 = [0 0 1]; P5 = [1 1 0]; P6 = [0 1 1]; P7 = [1 0 1]; P8 = [1 1 1]; hold on ...

3 years ago | 0

Answered
ode45 taking too long to solve set of ODEs.
Try to use ode15s instead of ode45. And prescribe the vector of output times. Otherwise ode45 will save all of its successful i...

3 years ago | 0

Answered
How to get a better fit with given equations that would approximately match given data output?
Use rng("default") as first line in your code.

3 years ago | 0

Answered
Finding a nonlinear equation root
fun = @(x)cosh(x).*cos(x)+1; icount = 0; for i = 1:2:21 x0 = i*pi/2; icount = icount + 1; xroot(icount) = fzero(fun,x...

3 years ago | 0

Answered
Problen with optimization of two parameters, and with differential equations
All curves that stem from your model tend to sqrt(keq/(1+keq)). Since your measurement data tend to 0.5, my guess is that you ha...

3 years ago | 0

Answered
Problen with optimization of two parameters, and with differential equations
The parameters you want to fit are not independent. Since T remains constant, the complete expression k0*exp(-Ea/(8310*T))*cc*...

3 years ago | 0

Answered
How to use fmincon's constraintviolation option
Can you tell me what I'm doing wrong? You try to betray yourself that your problem has a solution. But it has none.

3 years ago | 1

| accepted

Answered
Solving Integral in matlab
syms s a=sym('1'); b=sym('71/100'); c=sym('53/100'); f = 1/((s+a^2)*(s+a)*(s+b)*(s+c)); F = a*b*c/2*int(f) limit(F-subs(F,...

3 years ago | 0

Answered
im looking for the error in the following code, please help
DalphaS = CaputoDerivative(S(1:n),alpha,dt); DalphaI = CaputoDerivative(I(1:n),alpha,dt); DalphaR = CaputoDerivative(R(1:n),al...

3 years ago | 0

Load more