Answered
How do I use the random function in Fsolve Matlab?
This might help to get beta as a function of x: X = (0*2000/1100:0.1:2000/1100+10).'; n = 1e4; trials = 1e3; beta = zeros(...

4 years ago | 0

| accepted

Answered
How to solve differential equation where constant is a changing index
rng('default') a = 1000; %length of bed b = 200; %height of bed x = linspace(0,1000,100); bed = ((-.2*x + b) + (a/100.*rand...

4 years ago | 0

| accepted

Answered
Write a vector z with y
z = sign(y)

4 years ago | 1

Answered
buondary condition derivative equal zero PDE
rho = 8900; cp = 600; D = 15; a = D/(rho*cp); R = 0.05; uR = 25 + 273.15; u0 = 1000 + 273.15; rstart = 0.0; rend = R; ...

4 years ago | 0

| accepted

Answered
Output the value of the variable from the for loop to the matrix
for i = 1:... ? if z(1) <=3e5 ... else ... end G_drenazh_m(i,:) = [t,G_drenzah]; end save('G_drenazh.m...

4 years ago | 0

Answered
System of equations with an array of inputs and outputs
R = 9100; R2 = 2200; R3 = 47000; Vi = 3.3; syms dR V1 V2 Vp Vo eqn1 = R2*dR*Vi - R2*dR.*V1 == R*dR.*V1 - R*dR.*Vp + R*R2*V1...

4 years ago | 0

| accepted

Answered
How to solve the distance between two sets of points. Thanks a lot for your answer.
https://de.mathworks.com/help/stats/pdist.html

4 years ago | 0

Answered
How can I find s that satisfies the expression?
z = [...]; % vector of zi values Keq = [...]; % vector of corresponding Keq values fun = @(s) sum(...

4 years ago | 1

| accepted

Answered
I do not know why this is not plotting the multivariable function correctly?
F = X.*(10*Y+3).*(exp(-X.^2-Y.^2)); instead of F = X*(10*Y+3)*(exp(-X.^2-Y.^2));

4 years ago | 0

| accepted

Answered
Error using vertcat Dimensions of arrays being concatenated are not consistent.
Works for me. Maybe your input to A and B is wrong. Try A=[1 2;3 4]; B=[1;2] e.g.

4 years ago | 0

Answered
Index exceeds the number of array elements
Q=(int(diff(p),theta)); should be p, shouldn't it ?

4 years ago | 0

Answered
Solving 3 equations with 3 unknowns using for loop ?
You can't get a solution that fulfills all three equations exactly. The reason is that ((Xb-Xm*25e-3)*(-230.6815e-6))/((1.05e...

4 years ago | 0

Answered
Why do I get "no solution found" in fsolve while there is the actual value for them?
You might want to try ff = @(H)f(H).^2 H0=ones(1,20); [H,Hval]=fsolve(ff,H0)

4 years ago | 0

Answered
Calculate volume encapsuled by two surfaces
fun = @(x,y) max(fun1(x,y)-fun2(x,y),0); vol = integral2(fun,-4,4,-4,4)

4 years ago | 0

| accepted

Answered
Store final values from simulations of differential equation
XS = zeros(numSims,2); for j = 1:numSims % numSims is the number of independent % Stochastic simulations I want ...

4 years ago | 1

| accepted

Answered
Why does lsqnonlin find wrong coefficients?
diff = (x(1) *X(:,1) + x(2) * X(:,2) + x(3) * X(:,3) + x(4) * X(:,4)) - y; instead of diff = (x(1) *X(1) + x(2) * X(2) + x(3) ...

4 years ago | 1

| accepted

Answered
How do I use Euler's forward difference method and the second order Runge-Kutta method to work out a third order ODE?
Don't work with y1, y2 and y3, but with y = (y(1),y(2),y(3)). Define the vector of derivatives as f = @(t,y) [y(2) y(3) 3*y(2...

4 years ago | 0

| accepted

Answered
Neural Network Loss Function: Mean (absolute) Cubic Error
You want the error to be negative if t_i < y_i ? This won't work: The loss function should always be non-negative.

4 years ago | 0

Answered
Solving differential equation with Runge Kutta 4th order
y0 = 0.3075; tspan = [0 6]; [t,y] = ode45(@trial_ODE45,tspan,y0); plot(t,y,'-') function dydt = trial_ODE45(t,y) parame...

4 years ago | 1

Answered
How to deal with the connection between symbolic caculations and numerical caculations?
"matlabFunction" converts symbolic expressions into function handles for numerical calculations. help matlabFunction

4 years ago | 1

| accepted

Answered
How to solve the equation to get the result in atan2 form?
syms phi theta psi ROT = [cos(theta)*cos(phi)+sin(psi)*sin(theta)*sin(phi), -cos(theta)*sin(phi)+sin(psi)*sin(theta)*cos(phi), ...

4 years ago | 0

Answered
Problem with ode45
cons = [con1,con2,con3]; tspan = [0 5]; [t,x] = ode45(@(t,x)odefcn(t,x(1),x(2),x(3)), tspan, cons); plot(t,x(:,1),'color','c'...

4 years ago | 1

| accepted

Answered
Can the equations in the differential equation group be represented by symbols when matlab ode solves the differential equation group ?
function dcdzh2h2sco2_centri = dcdzh2h2sco2_centri(z,c) R = 8.314; g = 1000; Mi_h2s = 34; Mi_co2 = 44; Mi_ch4 = 16; syms...

4 years ago | 1

| accepted

Answered
Trying to solve 2 dimensional Partial differential equation using Finite Difference Method
For dx = dy = 0.01, Nx = Ny = 101, not 30 in your code. I just realized this after setting up the code below. dx = 0.01; dy ...

4 years ago | 1

Answered
How do I create this full diagonal matrix
n = 10; A = zeros(n); for i=1:n-1 A = A + diag((n-i)*ones(n-i,1),i) + diag((n-i)*ones(n-i,1),-i) end A = A + n*eye(n...

4 years ago | 0

Answered
OR gives invalid results
if left == 1 || left == 3 ... The condition "3" is empty and thus true. MATLAB does not relate the "3" to "left".

4 years ago | 0

| accepted

Answered
matrix elements must be finite
I get the error message that chol cannot be used since the input matrix is not positive definite. Analyze Pxx - maybe it has Na...

4 years ago | 0

| accepted

Answered
Polynomial surface fitting problem with constraint y <=1
If N is the number of (y12,x1,x2) data, use fmincon instead of lsqcurvefit and set the constraints a*x1_i^b + c*x2_i^d - 1 <= 0...

4 years ago | 1

Answered
Simultaneously solve over-defined system of 35 equations, with only 2 unknowns
Put the coefficients in a (35x2) matrix A and the numbers of the right-hand side in a (35x1) vector b. Then you can solve for C...

4 years ago | 1

Answered
How to obtain a histogram for 3d data?
Since your curves are all 1d, a 1d- histogram suffices if you identify x-axis coordinate with curve length or parametrized point...

4 years ago | 0

Load more