Answered

I know a certain y1 and I want to find the respective x1.

x1 = fzero(@(z)interp1(x,y,z)-y1,1)

I know a certain y1 and I want to find the respective x1.

x1 = fzero(@(z)interp1(x,y,z)-y1,1)

4 dagen ago | 2

Answered

ode23 , matrix equation , 2nd order DE

Convert the system to a first order system and write it as M*y' = f(t,y) Then use the mass-matrix option of the ODE solvers to...

ode23 , matrix equation , 2nd order DE

Convert the system to a first order system and write it as M*y' = f(t,y) Then use the mass-matrix option of the ODE solvers to...

4 dagen ago | 0

Answered

matrix vector multiplication complex number

b = [ 2 ,complex(1,-1)].' instead of b = [ 2 ,complex(1,-1)]'

matrix vector multiplication complex number

b = [ 2 ,complex(1,-1)].' instead of b = [ 2 ,complex(1,-1)]'

5 dagen ago | 1

| accepted

Answered

How to tell ode15s to change its max time step for a specific short time range?

Integrate from 0 to 0.05, restart the solver and solve from 0.05-0.1, restart the solver and solve from 0.1 - 20. Every time you...

How to tell ode15s to change its max time step for a specific short time range?

Integrate from 0 to 0.05, restart the solver and solve from 0.05-0.1, restart the solver and solve from 0.1 - 20. Every time you...

6 dagen ago | 1

| accepted

Answered

How can I create a handle-function with a double summation on 201 variables (40401 terms)?

FUN = @(W) (W.*sigma).'*C*(W.*sigma)

How can I create a handle-function with a double summation on 201 variables (40401 terms)?

FUN = @(W) (W.*sigma).'*C*(W.*sigma)

7 dagen ago | 0

| accepted

Answered

Efficient way to compute a double integral within a double integral

function main l1 = ...; u1 = ...; l2 = ...; u2 = ...; value_outer_integral = integral2(@fun,l1,u1,l2,u2) end ...

Efficient way to compute a double integral within a double integral

function main l1 = ...; u1 = ...; l2 = ...; u2 = ...; value_outer_integral = integral2(@fun,l1,u1,l2,u2) end ...

11 dagen ago | 0

| accepted

Answered

Finding point of intersection between a line and a sphere

Sphere: (x-xs)^2 + (y-ys)^2 + (z-zs)^2 = R^2 Line: [x y z] = Pm + l*normal Thus (Pm(1)+l*normal(1)-xs)^2 + (Pm(2)+l*normal(...

Finding point of intersection between a line and a sphere

Sphere: (x-xs)^2 + (y-ys)^2 + (z-zs)^2 = R^2 Line: [x y z] = Pm + l*normal Thus (Pm(1)+l*normal(1)-xs)^2 + (Pm(2)+l*normal(...

12 dagen ago | 2

| accepted

Answered

Numerical integral over the whole spherical volume of a crystallite

Nd = 1e23; phi = 20; Ld = 18e-9; R = 40e-9; fun = @(r) 4*pi*r.^2.*(1-exp(phi + 1/6*(r/Ld).^2)); value_integral = Nd*integra...

Numerical integral over the whole spherical volume of a crystallite

Nd = 1e23; phi = 20; Ld = 18e-9; R = 40e-9; fun = @(r) 4*pi*r.^2.*(1-exp(phi + 1/6*(r/Ld).^2)); value_integral = Nd*integra...

13 dagen ago | 1

| accepted

Answered

Numerical integration with many parameters.

function main L = 1; T = 100; r = 0.03; I1 = 0.5; p = 0.005; epsilon = 0.5; beta = 0.1; rho = 0.5; ...

Numerical integration with many parameters.

function main L = 1; T = 100; r = 0.03; I1 = 0.5; p = 0.005; epsilon = 0.5; beta = 0.1; rho = 0.5; ...

14 dagen ago | 2

| accepted

Answered

How to write a code for a bounded periodic function?

t(1) = 0; y1(1) = 600; y2(1) = 1000; h = 0.5; t_end = 5; t = 0:h:t_end; a = 2; c = 3; alfa = 10^-3; gamma = 6*10^-3; f...

How to write a code for a bounded periodic function?

t(1) = 0; y1(1) = 600; y2(1) = 1000; h = 0.5; t_end = 5; t = 0:h:t_end; a = 2; c = 3; alfa = 10^-3; gamma = 6*10^-3; f...

14 dagen ago | 1

| accepted

Answered

Probability distribution of a multiple variable sum

Take samples from your empirical data and use Monte-Carlo-simulation to determine the above probability. This code should help ...

Probability distribution of a multiple variable sum

Take samples from your empirical data and use Monte-Carlo-simulation to determine the above probability. This code should help ...

ongeveer een maand ago | 1

| accepted

Answered

How can we provide minimum distance i.e. 20 between each random generated node?

I think Jan Simon's answer will at least partially solve your problem: https://de.mathworks.com/matlabcentral/answers/142322-fi...

How can we provide minimum distance i.e. 20 between each random generated node?

I think Jan Simon's answer will at least partially solve your problem: https://de.mathworks.com/matlabcentral/answers/142322-fi...

ongeveer een maand ago | 1

Answered

Optimization problem with a function of 2 parameters

TC = @(x) (QC(x(1))+FC(x(2))+ RC)/E(x(2)); lb = [1.5e-5,1000]; ub = [2.5e-5,100000]; sol = fmincon(TC,[2e-5,10000],[],[],[],[...

Optimization problem with a function of 2 parameters

TC = @(x) (QC(x(1))+FC(x(2))+ RC)/E(x(2)); lb = [1.5e-5,1000]; ub = [2.5e-5,100000]; sol = fmincon(TC,[2e-5,10000],[],[],[],[...

ongeveer een maand ago | 0

| accepted

Answered

Solve a system of equations

x22 - w0 = x13 = x31 * x32 = x22 * x21 / (x22+k2*V2) * x22 = x22 * (x22/(x22+k1*V1)) / (x22+k2*V2) * x22 This gives a quad...

Solve a system of equations

x22 - w0 = x13 = x31 * x32 = x22 * x21 / (x22+k2*V2) * x22 = x22 * (x22/(x22+k1*V1)) / (x22+k2*V2) * x22 This gives a quad...

ongeveer een maand ago | 0

| accepted

Answered

Can anyone help me in coding matlab code for Quadratically Constrained Quadratic Program (QCQP)?

function main H = [2 0 0;0 2 0;0 0 2]; f = [-1; -2 ;-3]; R = [7 0 0;0 7 0;0 0 7]; h = [-4 ;-5 ;-6]; c = 88; ...

Can anyone help me in coding matlab code for Quadratically Constrained Quadratic Program (QCQP)?

function main H = [2 0 0;0 2 0;0 0 2]; f = [-1; -2 ;-3]; R = [7 0 0;0 7 0;0 0 7]; h = [-4 ;-5 ;-6]; c = 88; ...

ongeveer een maand ago | 0

Answered

Solving 2nd order ODE with ODE45

M = matlabFunction(V,'vars', {'t','Y'})

Solving 2nd order ODE with ODE45

M = matlabFunction(V,'vars', {'t','Y'})

ongeveer een maand ago | 1

Answered

Solving two nonlinear equations

A = 0.5:0.01:2; alpha = 0.5; l00 = 1; for i = 1:numel(A) a = A(i); fun = @(l0) 1 + alpha*l0^(alpha-1) - l0 - alpha*a*(2...

Solving two nonlinear equations

A = 0.5:0.01:2; alpha = 0.5; l00 = 1; for i = 1:numel(A) a = A(i); fun = @(l0) 1 + alpha*l0^(alpha-1) - l0 - alpha*a*(2...

ongeveer een maand ago | 1

| accepted

Answered

How to plot a nonlinear equation using FSOLVE in MATLAB

K = 1:627; kp = 4500; h = 1.0e-3; d = 7.5e-3; ky0 = 1.0; Ky = zeros(numel(K),1); %fKy = zeros(numel(K),1); for i = 1:nume...

How to plot a nonlinear equation using FSOLVE in MATLAB

K = 1:627; kp = 4500; h = 1.0e-3; d = 7.5e-3; ky0 = 1.0; Ky = zeros(numel(K),1); %fKy = zeros(numel(K),1); for i = 1:nume...

ongeveer een maand ago | 0

Answered

function of integral bound

function main sol = fzero(@fun,1.0) end function res = fun(b) amin = 0; amax = b; xmin = 0; xmax = @(a) a+b...

function of integral bound

function main sol = fzero(@fun,1.0) end function res = fun(b) amin = 0; amax = b; xmin = 0; xmax = @(a) a+b...

ongeveer 2 maanden ago | 0

| accepted

Answered

How to redefine a variable inside the function?

Add the nonlinear constraint x(3) - x31*x32 = 0 in function "nonlcon". And remove the lines y33=x31*x32; x13=y33; % It shou...

How to redefine a variable inside the function?

Add the nonlinear constraint x(3) - x31*x32 = 0 in function "nonlcon". And remove the lines y33=x31*x32; x13=y33; % It shou...

ongeveer 2 maanden ago | 0

| accepted

Answered

A for loop need help ASAP

for i = 0:3:300 j = i/3 + 1; Fi(j)= atan(-(A5(1,1+i)/A5(1,2+i))); Theta(j) = acos(A5(1,3+i)); Psi(j)= atan(A3(1,3+i)...

A for loop need help ASAP

for i = 0:3:300 j = i/3 + 1; Fi(j)= atan(-(A5(1,1+i)/A5(1,2+i))); Theta(j) = acos(A5(1,3+i)); Psi(j)= atan(A3(1,3+i)...

ongeveer 2 maanden ago | 0

Answered

Solving system of ODE with dataset of variables

[t,Ts]=ode45(@(t,Ts)Temp_EH(t,Ts,time,Qin,Qout,Tin,rad,Tair,Vol_hip,Vol_ep,H_ep,AreaThermo,eair,f,dens,Cp,sigma,A,RL,eee,c1,Tran...

Solving system of ODE with dataset of variables

[t,Ts]=ode45(@(t,Ts)Temp_EH(t,Ts,time,Qin,Qout,Tin,rad,Tair,Vol_hip,Vol_ep,H_ep,AreaThermo,eair,f,dens,Cp,sigma,A,RL,eee,c1,Tran...

ongeveer 2 maanden ago | 1

| accepted

Answered

error in fmincon code

V0 = [1;2;4]; objective = @(V)[-s.',(l-q).']*V; But why do you shoot with canons on sparrows (means: why do you use a nonlinea...

error in fmincon code

V0 = [1;2;4]; objective = @(V)[-s.',(l-q).']*V; But why do you shoot with canons on sparrows (means: why do you use a nonlinea...

ongeveer 2 maanden ago | 0

| accepted

Answered

How can i find the distance between every point in two different point-clouds

https://de.mathworks.com/help/stats/pdist2.html min (D) or min (D.') seems to be what you are looking for.

How can i find the distance between every point in two different point-clouds

https://de.mathworks.com/help/stats/pdist2.html min (D) or min (D.') seems to be what you are looking for.

ongeveer 2 maanden ago | 1

Answered

complex solutions in ode23s

I guess there exist some operation in the calculation of your time derivatives that gives a complex result (e.g. sqrt of a negat...

complex solutions in ode23s

I guess there exist some operation in the calculation of your time derivatives that gives a complex result (e.g. sqrt of a negat...

ongeveer 2 maanden ago | 0

| accepted

Answered

Cannot get the right coefficient from PCHIP fit

From the documentation: Since the polynomial coefficients in coefs are local coefficients for each interval, you must subtract ...

Cannot get the right coefficient from PCHIP fit

From the documentation: Since the polynomial coefficients in coefs are local coefficients for each interval, you must subtract ...

2 maanden ago | 0

| accepted

Answered

Could anyone help me to solve the issue.

If "initial_position" is an array with 5 elements and "common_position" is a scalar, you can simply type difference = common_po...

Could anyone help me to solve the issue.

If "initial_position" is an array with 5 elements and "common_position" is a scalar, you can simply type difference = common_po...

2 maanden ago | 0

Answered

Fitting a straight line to a set of 3-D points

What I would do is find the average P¯of your points and an eigenvector V of the covariance matrix for its largest eigenvalue. ...

Fitting a straight line to a set of 3-D points

What I would do is find the average P¯of your points and an eigenvector V of the covariance matrix for its largest eigenvalue. ...

2 maanden ago | 0

Answered

optimizing linprog 2 variables with different dimensions

Set V = [V(1) V(2) V(3)] = [z y(1) y(2)] as "combined" solution vector and write all your equations in V instead of z and y. ...

optimizing linprog 2 variables with different dimensions

Set V = [V(1) V(2) V(3)] = [z y(1) y(2)] as "combined" solution vector and write all your equations in V instead of z and y. ...

2 maanden ago | 0

| accepted