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

6 years ago | 0

Answered
Extracting values that are greater than the threshold
OxygenAlt = Alert(Alert(:,3)>21)

6 years ago | 1

Answered
Fitting to an intergral
Use "ArrayValued=true" as option in the call to integral.

6 years 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,:...

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

6 years ago | 1

| accepted

Answered
Best way to solve my implicit equation
Use "fzero" or "fsolve".

6 years ago | 1

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

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

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

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

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

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

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

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

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

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

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

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

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

7 years 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);

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

7 years ago | 1

| accepted

Answered
How do at write the equation
f = x.^2.*sin(x*pi)

7 years ago | 0

| accepted

Answered
Plotting the zeros of jacobi polynomials
I'd use https://de.mathworks.com/help/symbolic/jacobip.html :-)

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

7 years 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));

7 years ago | 2

Answered
Using the function fmincon
[x] = fmincon (@FUNCTION,coef,[],[],Aeq,beq);

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

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

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

7 years ago | 0

| accepted

Answered
Solve systems of linear equations Ax = B for x
https://en.wikipedia.org/wiki/Cramer%27s_rule

7 years ago | 0

Load more