Answered

what numerical approach is used for bvpinit?

In bvpinit, the user just specifies a guess on how the solution of the boundary value problem might look. A numerical method i...

what numerical approach is used for bvpinit?

In bvpinit, the user just specifies a guess on how the solution of the boundary value problem might look. A numerical method i...

6 hours ago | 0

Answered

Unexpected output when trying to plot the solution to a system of nonlinear differential equations

Use hold on between the two plot commands.

Unexpected output when trying to plot the solution to a system of nonlinear differential equations

Use hold on between the two plot commands.

2 days ago | 1

| accepted

Answered

How do I make a function work with vectors?

tanH = (exp(x)-exp(-x))./(exp(x)+exp(-x))

How do I make a function work with vectors?

tanH = (exp(x)-exp(-x))./(exp(x)+exp(-x))

3 days ago | 0

Answered

How can I put an integral inside a for loop when the bounds depend on the loop's variable?

Phi_ij1 =@(i,j) integral2(@(y,x) B_zi(i,x,y),0,y_min1(j),0,@(y)x_max1(y,j));

How can I put an integral inside a for loop when the bounds depend on the loop's variable?

Phi_ij1 =@(i,j) integral2(@(y,x) B_zi(i,x,y),0,y_min1(j),0,@(y)x_max1(y,j));

4 days ago | 1

Answered

Curve fitting toolbox - gaussian curve to histogram with no workspace data for the y - value

I think Matlab's "mle" is what you want instead of the curve fitting toolbox.

Curve fitting toolbox - gaussian curve to histogram with no workspace data for the y - value

I think Matlab's "mle" is what you want instead of the curve fitting toolbox.

7 days ago | 0

Answered

lsqnonlin and stretched exponential function

error_bounds = nlparci(x,residual,'jacobian',J) after the call to lsqnonlin. If you don't have a toolbox with nlparci, search ...

lsqnonlin and stretched exponential function

error_bounds = nlparci(x,residual,'jacobian',J) after the call to lsqnonlin. If you don't have a toolbox with nlparci, search ...

8 days ago | 0

Answered

I'm getting an error related to fmincon

If you mean the eigenvalue largest in magnitude, this should give you a start. Incorporating fmincon can automatize the search ...

I'm getting an error related to fmincon

If you mean the eigenvalue largest in magnitude, this should give you a start. Incorporating fmincon can automatize the search ...

8 days ago | 0

Answered

root of nonlinear equation

ft = @( c ) 0.25* ... instead of ft = 0.25* ...

root of nonlinear equation

ft = @( c ) 0.25* ... instead of ft = 0.25* ...

9 days ago | 0

| accepted

Answered

stop Ode45 when y is less than a value

As defined, ode45 expects myEvent to have 2 input parameters, but you use 3. Use Opt = odeset('Events',@(t,u)myEvent(t,u,minu)...

stop Ode45 when y is less than a value

As defined, ode45 expects myEvent to have 2 input parameters, but you use 3. Use Opt = odeset('Events',@(t,u)myEvent(t,u,minu)...

9 days ago | 0

| accepted

Answered

How to add the value of the 3 highest elements automatically from a vector?

[~,idx]=maxk(y,3); y(idx)=y(idx)+sx; y

How to add the value of the 3 highest elements automatically from a vector?

[~,idx]=maxk(y,3); y(idx)=y(idx)+sx; y

9 days ago | 0

Answered

Extracting values that are greater than the threshold

OxygenAlt = Alert(Alert(:,3)>21)

Extracting values that are greater than the threshold

OxygenAlt = Alert(Alert(:,3)>21)

9 days ago | 0

Answered

Fitting to an intergral

Use "ArrayValued=true" as option in the call to integral.

Fitting to an intergral

Use "ArrayValued=true" as option in the call to integral.

10 days ago | 1

| accepted

Answered

Hello guys, I need help.

[X1,X2,X3]=ndgrid(x1,x2,x3); Z=f(X1,X2,X3); %assumes f is vectorized M=[X1,X2,X3,Z]; [~,idx]=sort(M(:,4)); sortedM=M(idx,:...

Hello guys, I need help.

[X1,X2,X3]=ndgrid(x1,x2,x3); Z=f(X1,X2,X3); %assumes f is vectorized M=[X1,X2,X3,Z]; [~,idx]=sort(M(:,4)); sortedM=M(idx,:...

10 days ago | 0

Answered

Temperature ramp then keep it at constant temperature

Copy the lines where you define the global parameters to the beginning of function "fun" and remove them in the upper part of th...

Temperature ramp then keep it at constant temperature

Copy the lines where you define the global parameters to the beginning of function "fun" and remove them in the upper part of th...

10 days ago | 0

Answered

How can i implemente this PDE system?

Use "pdepe". You will need to specify four boundary conditions for this solver, although only two for the T equation were neces...

How can i implemente this PDE system?

Use "pdepe". You will need to specify four boundary conditions for this solver, although only two for the T equation were neces...

11 days ago | 0

| accepted

Answered

For Loop Which Skips Numbers Based on Row Vector

Use "setdiff" to remove the row vector elements from the range of the for-loop and name the vector v. Then simply type for v ...

For Loop Which Skips Numbers Based on Row Vector

Use "setdiff" to remove the row vector elements from the range of the for-loop and name the vector v. Then simply type for v ...

11 days ago | 0

Answered

Euler function where you can define equation, starting x and y values, number of steps and the step length

Use g = f or g = @(x,y) f(x,y) instead of g = @(x,y) f.

Euler function where you can define equation, starting x and y values, number of steps and the step length

Use g = f or g = @(x,y) f(x,y) instead of g = @(x,y) f.

11 days ago | 0

| accepted

Answered

Integrate for a specific period of time

t=0:.01:10; x = zeros(numel(t)); x(1) = 1; fun_xdot = @(t,x) -2*(x^3) + sin(0.5*t)*x; for i = 1:numel(t)-1 x(i+1) = x(i...

Integrate for a specific period of time

t=0:.01:10; x = zeros(numel(t)); x(1) = 1; fun_xdot = @(t,x) -2*(x^3) + sin(0.5*t)*x; for i = 1:numel(t)-1 x(i+1) = x(i...

7 months ago | 0

| accepted

Answered

Why does fsolve seem not iterate towards the solution?

k = 0.1007; rZ = 12.6518; Rs = 0.164; Cmax = 7.0e-11; W = 1.704e8; iZ = 14.5273; Ls = 1.1e-7; a1 = (k/1000)^2*(rZ-Rs); ...

Why does fsolve seem not iterate towards the solution?

k = 0.1007; rZ = 12.6518; Rs = 0.164; Cmax = 7.0e-11; W = 1.704e8; iZ = 14.5273; Ls = 1.1e-7; a1 = (k/1000)^2*(rZ-Rs); ...

7 months ago | 0

| accepted

Answered

I am getting this error "Index in position 1 is invalid. Array indices must be positive integers or logical values." Kindly help me clear this.

i and j are not defined at this line of your code ; they are first introduced one line later.

I am getting this error "Index in position 1 is invalid. Array indices must be positive integers or logical values." Kindly help me clear this.

i and j are not defined at this line of your code ; they are first introduced one line later.

7 months ago | 0

Answered

Finding Linear regression equation

x = [65 65 62 67 69 65 61 67]; y = [105 125 110 120 140 135 95 130]; X = [ones(numel(x),1),x.']; p = X\(y.'); b = p(1) m ...

Finding Linear regression equation

x = [65 65 62 67 69 65 61 67]; y = [105 125 110 120 140 135 95 130]; X = [ones(numel(x),1),x.']; p = X\(y.'); b = p(1) m ...

7 months ago | 0

Answered

Non linear least squares for a system of equations

fun = @(z)[z(1)^0.5*Ydata+z(2)-X1data,... z(1)^0.1*Ydata+z(2)-X2data,... z(1)^0.15*Ydata+z(2)-X3data]; ...

Non linear least squares for a system of equations

fun = @(z)[z(1)^0.5*Ydata+z(2)-X1data,... z(1)^0.1*Ydata+z(2)-X2data,... z(1)^0.15*Ydata+z(2)-X3data]; ...

7 months ago | 1

| accepted

Answered

How to iterate with fsolve to find Mach number

function main pt2pinf = [1.9, 2.7, 3.5, 4.3, 5.1, 5.9, 6.7, 7.5, 27.5, 47.5, 67.5 ,87.5 ,107.5,127.5, 147.5, 200, 252.5, 305,...

How to iterate with fsolve to find Mach number

function main pt2pinf = [1.9, 2.7, 3.5, 4.3, 5.1, 5.9, 6.7, 7.5, 27.5, 47.5, 67.5 ,87.5 ,107.5,127.5, 147.5, 200, 252.5, 305,...

7 months ago | 0

| accepted

Answered

Setting of mass matrix

options = odeset('RelTol',1e-9,'AbsTol',1e-9*ones(608,1),'Mass', @(t,y)diag([ones(1,604) sin(t) 1 1 0])); or options = odeset(...

Setting of mass matrix

options = odeset('RelTol',1e-9,'AbsTol',1e-9*ones(608,1),'Mass', @(t,y)diag([ones(1,604) sin(t) 1 1 0])); or options = odeset(...

7 months ago | 2

Answered

How do I declare and iterate a variable in an ODE driver file?

yold = -Inf; Ssnh_in_1 = 1; [t,y]=ode15s(@(t,y)pha_cont(t,y,Ssnh_in_1),[0,15],y0); ynew = y(end,3); while yold < ynew Ssn...

How do I declare and iterate a variable in an ODE driver file?

yold = -Inf; Ssnh_in_1 = 1; [t,y]=ode15s(@(t,y)pha_cont(t,y,Ssnh_in_1),[0,15],y0); ynew = y(end,3); while yold < ynew Ssn...

7 months ago | 0

| accepted

Answered

Ode45 solves an equation that containing a definite integral term

function main a = ...; b = ...; c = ...; d = ...; u0 = 1; usol = fzero(@(u)fun(u,a,b,c,d),u0); fun_ode = @...

Ode45 solves an equation that containing a definite integral term

function main a = ...; b = ...; c = ...; d = ...; u0 = 1; usol = fzero(@(u)fun(u,a,b,c,d),u0); fun_ode = @...

7 months ago | 1

Answered

Problem with jacobiSN function

I suggest you follow the steps suggested under https://de.mathworks.com/help/matlab/matlab_prog/calling-functions.html

Problem with jacobiSN function

I suggest you follow the steps suggested under https://de.mathworks.com/help/matlab/matlab_prog/calling-functions.html

7 months ago | 0