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

5 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); ...

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

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

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

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

5 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(...

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

5 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 = @...

6 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

6 months ago | 0

Answered

Weighted linear combination between vectors

weights = [0.25 0.25 0.25 0.25]; C = weights(1)*W(:,1) + weights(2)*W(:,2) + weights(3)*W(:,3) + weights(4)*W(:,4);

Weighted linear combination between vectors

weights = [0.25 0.25 0.25 0.25]; C = weights(1)*W(:,1) + weights(2)*W(:,2) + weights(3)*W(:,3) + weights(4)*W(:,4);

6 months ago | 1

Answered

Can you help me please !

function main tspan=[0 5]; y0=[0;100;0;10]; [t,y]=ode45(@khidonghoc,tspan,y0); plot(t,y(:,1),t,y(:,3)) hold on;gr...

Can you help me please !

function main tspan=[0 5]; y0=[0;100;0;10]; [t,y]=ode45(@khidonghoc,tspan,y0); plot(t,y(:,1),t,y(:,3)) hold on;gr...

6 months ago | 1

| accepted

Answered

Plotting the zeros of jacobi polynomials

I'd use https://de.mathworks.com/help/symbolic/jacobip.html :-)

Plotting the zeros of jacobi polynomials

I'd use https://de.mathworks.com/help/symbolic/jacobip.html :-)

6 months ago | 0

Answered

Solving BVP for DAE in Matlab

MATLAB has no built-in solver for boundary value differential-algebraic equations. COLDAE is a very good solver, but it's writt...

Solving BVP for DAE in Matlab

MATLAB has no built-in solver for boundary value differential-algebraic equations. COLDAE is a very good solver, but it's writt...

6 months ago | 1

| accepted

Answered

question about sinc function

t = -511*0.005:0.005:512*0.005; u_1 = 3/2*(110*sinc(110*t)-60*sinc(60*t));

question about sinc function

t = -511*0.005:0.005:512*0.005; u_1 = 3/2*(110*sinc(110*t)-60*sinc(60*t));

6 months ago | 2

Answered

Using the function fmincon

[x] = fmincon (@FUNCTION,coef,[],[],Aeq,beq);

Using the function fmincon

[x] = fmincon (@FUNCTION,coef,[],[],Aeq,beq);

6 months ago | 0

| accepted

Answered

Solving 1D advection equation

pdepe is not suited to solve pdes without second-order spatial derivative. You will have to discretize the above equation on yo...

Solving 1D advection equation

pdepe is not suited to solve pdes without second-order spatial derivative. You will have to discretize the above equation on yo...

6 months ago | 0

Answered

ODE solver problem with input

function main [t,y] = ode45(@Flug_DGL,[1,300],[0;0]); plot(t,y(:,1)); end function ypunktpunkt = Flug_DGL(t,y) u ...

ODE solver problem with input

function main [t,y] = ode45(@Flug_DGL,[1,300],[0;0]); plot(t,y(:,1)); end function ypunktpunkt = Flug_DGL(t,y) u ...

6 months ago | 0

Answered

How to calculate the probabilistic constraints in Matlab?

a1+a2+a3 = norminv(0.9,mu,sigma) https://de.mathworks.com/help/stats/norminv.html

How to calculate the probabilistic constraints in Matlab?

a1+a2+a3 = norminv(0.9,mu,sigma) https://de.mathworks.com/help/stats/norminv.html

6 months ago | 0

| accepted

Answered

Solve systems of linear equations Ax = B for x

https://en.wikipedia.org/wiki/Cramer%27s_rule

Solve systems of linear equations Ax = B for x

https://en.wikipedia.org/wiki/Cramer%27s_rule

6 months ago | 0

Answered

system on inequations of a problem in mathematic

The coloured region is defined by three inequalities: y >= (x-x_A)/(x_B-x_A)*y_B+(x-x_B)/(x_A-x_B)*y_A y >= (x-x_A)/(x_D-x_A)*...

system on inequations of a problem in mathematic

The coloured region is defined by three inequalities: y >= (x-x_A)/(x_B-x_A)*y_B+(x-x_B)/(x_A-x_B)*y_A y >= (x-x_A)/(x_D-x_A)*...

6 months ago | 1

| accepted

Answered

Why do my coeffvalues not produce a sensible result?

If you use the 'Normalize','on' fitting option, your polynomial has powers of (x-meanx)/stdx and (y-meany)/stdy instead of x and...

Why do my coeffvalues not produce a sensible result?

If you use the 'Normalize','on' fitting option, your polynomial has powers of (x-meanx)/stdx and (y-meany)/stdy instead of x and...

6 months ago | 0

| accepted

Answered

solving a system of nonlinear equations in terms of parameter (essentially rearrangement)

Does this work ? syms a b c k t x eqn = x == a + (((c - k + (1/3)*(((c - k + (1/3)*t*(1-a-b)*(3+b-a) + t*(2*(1-b-x)^2 - (x-a)...

solving a system of nonlinear equations in terms of parameter (essentially rearrangement)

Does this work ? syms a b c k t x eqn = x == a + (((c - k + (1/3)*(((c - k + (1/3)*t*(1-a-b)*(3+b-a) + t*(2*(1-b-x)^2 - (x-a)...

6 months ago | 0

Answered

estimation of parameters using lsqnonlin

1. p= lsqnonlin(@(p) interest(p),p0) Use p=lsqnonlin(@(p)interest(p,t,c1meas,c2meas,c3meas,c4meas,c5meas),p0) instead. 2. ...

estimation of parameters using lsqnonlin

1. p= lsqnonlin(@(p) interest(p),p0) Use p=lsqnonlin(@(p)interest(p,t,c1meas,c2meas,c3meas,c4meas,c5meas),p0) instead. 2. ...

6 months ago | 0

| accepted

Answered

How to fix: Index exceeds matrix dimensions

The for-loop increases i automatically. Thus remove the line "i=i+1".

How to fix: Index exceeds matrix dimensions

The for-loop increases i automatically. Thus remove the line "i=i+1".

6 months ago | 0

Answered

simple integration calculation to find the area ?

value_integral = trapz(T,V)

simple integration calculation to find the area ?

value_integral = trapz(T,V)

6 months ago | 0

Answered

Matrix dimension do not agree when solving a singular bvp using bvp4c

Your boundary conditions can not be handled by bvp4c: You prescribe two times that y(2)=0 at the left boundary point and you gi...

Matrix dimension do not agree when solving a singular bvp using bvp4c

Your boundary conditions can not be handled by bvp4c: You prescribe two times that y(2)=0 at the left boundary point and you gi...

6 months ago | 0

Answered

Trying to solve a definite integral but wont give numerical solution

Q=150; k=1.49; n=0.02; So=0.0048; b=3; g=32.2; x1=0; y1=3; %x2=200; h=20; x2=200; f_xy=@(y)(So-((Q*n)./(k*b*(y.^(5/3)...

Trying to solve a definite integral but wont give numerical solution

Q=150; k=1.49; n=0.02; So=0.0048; b=3; g=32.2; x1=0; y1=3; %x2=200; h=20; x2=200; f_xy=@(y)(So-((Q*n)./(k*b*(y.^(5/3)...

6 months ago | 1

| accepted

Answered

How to translate an ArgMin with a summation inside?

dt = (t-s*x).'*(t-s*x); where x is a scalar and t and s are column vectors of the same length.

How to translate an ArgMin with a summation inside?

dt = (t-s*x).'*(t-s*x); where x is a scalar and t and s are column vectors of the same length.

6 months ago | 0