Answered
Index exceeds matrix dimensions.
y0=y(end,:); instead of y0=y(end,1);

7 years ago | 1

| accepted

Answered
Why am I getting the following errors
dS = @(t, x) (dSV(t,x) - x(2)*dV(t,x))/x(5); dP = @(t, x) (dPV(t,x) - x(3)*dV(t,x))/x(5); dG = @(t, x) (dGV(t,x) - x(4)*dV(t,x...

7 years ago | 0

| accepted

Answered
How to solve an ODE with external time-varying source?
a) Save [t1 t2 ... tn], [x1 x2 ... xn] in two arrays T and X. b) Pass T and X to the integrator: [tsim,ysim] = ode45(@(t,y)fu...

7 years ago | 0

| accepted

Answered
How to find 3 unknows with Least square a*cosh(b*x)+c, not using toolbox?
data = load('koordinater'); x = data.x; y = data.y; fun = @(p)sum((p(1)*cosh(p(2)*x)+p(3)-y).^2); p0 = [1;1;1]; p = fminsea...

7 years ago | 0

Answered
How to find the optimum intercept by fixing the gradient as a fit to experimental data?
Use polyfit to fit a polynomial of degree 0 against log(y) - n*log(x) and take exp() of the result. This gives you optimal A f...

7 years ago | 2

| accepted

Answered
can someone write me a code for this?
Use MATLAB's "pdepe". Note that your equation can be written as du/dt = 1/r * d/dr (r * a^2 * du/dr)

7 years ago | 0

Answered
solve pde with neumann boundary conditions
At the right boundary (x=x_n) D^2y/dx^2 ~ (dy_n/dx - dy_(n-1/2)/dx) /(x_n-x_(n-1/2)) ~ (dy_n/dx - (y_n-y_(n-1))/(x_n-x_(n...

7 years ago | 0

Answered
Dear Reserach Team! I need to calculate numerically definite integral of a function g(y), where g(y) is a numerical integral of f(x,y). Please advise how to do it (the details are shown below). Many thanks in advance!.
function main g = @(y) integral(@(x)f(x,y),0,1); s = integral(g,0,2,'ArrayValued',true) end function fun_f = f(x,y) ...

7 years ago | 0

| accepted

Answered
How to use fminsearch with a function containing vectors of symbols
Write a function for f: function main h1 = ...: h2 = ...; x0 = [x10,x20,y10,y20]; % initial guess for solution x = ...

7 years ago | 1

| accepted

Answered
Forward Euler solution plotting
function main x0 = 0.0; x1 = 1.5; fun = @(x,y) y-x; h = [0.25 0.05 0.01]; for i = 1:numel(h) [x{i},y{i}] = e...

7 years ago | 0

Answered
Error using lsqcurvefit (line 262) Function value and YDATA sizes are not equal.
In "kinetics", use tspan = t; instead of tspan = [0 30720];

7 years ago | 0

| accepted

Answered
How can I determine which roots are closest to the unit circle?
[~,ix] = min(abs(real(root_out).^2+imag(real_out).^2-1)./sqrt(real(root_out).^2+imag(real_out).^2)); root_out(ix)

7 years ago | 0

Answered
FZERO cannot continue because user-supplied function_handle, A and B must be floating-point scalars.
Make a loop over the elements of p. "fzero" cannot determine zeros of vector-valued functions (like in fzero(@(y) 2.*u.*y.*(20...

7 years ago | 0

| accepted

Answered
plots giving wrong out output
In your code, replace g1/2*m1 g2/2*m2 by g1/(2*m1) g2/(2*m2)

7 years ago | 1

| accepted

Answered
Question about using ODE45 to solve a differential equation using column vectors as inputs
Use "interp1" to interpolate to the time t for which the solver requires the scalar values of ho, Ta and I. Here is an example:...

7 years ago | 0

| accepted

Answered
How to integrate a vector?
Use "trapz". Best wishes Torsten.

7 years ago | 0

Answered
minimization fmincon with ode
To get dobjectfun/dx numerically, you had to solve even more ODEs: https://de.mathworks.com/help/optim/ug/optimizing-a-simulati...

7 years ago | 0

| accepted

Answered
Optimizing parameters for a system of linear equations
One possible choice: a_i = g_i / 2 * sum_{j=1}^{j=65} (f_j - g_j) / sum_{j=1}^{j=65} (f_j * g_j) b_i = -f_i / 2 * sum_{j=1}^{j...

7 years ago | 0

Answered
Using a function with multiple variable
function main %Manual inputs a_Ge = 9.64; a_ZnS = 26.4; %Reading files water_files = csvread('Water_IOR_Hale.csv');...

7 years ago | 1

| accepted

Answered
Using Solve with 'albersheim'
Pfa = 7e-10; SNR = 14; Pd0 = 1.0; Pd = fzero(@(x)albersheim(x,Pfa)-SNR,Pd0);

7 years ago | 0

| accepted

Answered
solving many linear differential equations through ODE solver.
Don't use symbolic variables together with "many" differential equations. Use a numerical ODE integrator instead (e.g. ODE15S)....

7 years ago | 1

| accepted

Answered
how do i solve for 't' ?
Try eqn1 = 190.0 == 380.0-379.69109947074029287421462846085/2*(exp((-1000842.1052631578947368421052632+1000813.5574673472470455...

7 years ago | 0

Answered
How can I make an array of sin(1), sin(2), ... , sin(100)?
x=1:100; sinarray=sind(x)

7 years ago | 0

| accepted

Answered
The polynomial for the cubic spline is with x or (x-xi) ?
Read the chapter "pp - piecewise polynomial" under "Output Arguments" in https://de.mathworks.com/help/matlab/ref/spline.html

7 years ago | 0

| accepted

Answered
Cubic spline in Matlab works with natural boundary?
By default, MATLAB uses "not-a-knot" condition in end points: http://www.cs.tau.ac.il/~turkel/notes/numeng/spline_note.pdf

7 years ago | 1

| accepted

Answered
solving unknown variables in matrices
[4 -2 1; 1 1 1;4 2 1]*[k;l;m] = [4; 1; -4]

7 years ago | 1

Answered
I get this error:"This system does not seem to be linear."
The product of differentials in your equations (diff(theta1)*diff(theta3), e.g.) makes it impossible to use ODE45. I don't kno...

7 years ago | 2

| accepted

Answered
How to solve a system of two paired differential equations
function main [l,y]=ode45(@myODE,[0 8],[0.5,30]); plot(l,y(:,1)) end function dy = myODE(l,y) u=y(1); Tp=y(2); dTpdl = ...

7 years ago | 2

| accepted

Answered
How can I make a program which can determine the coefficients
https://de.mathworks.com/matlabcentral/answers/309182-how-to-get-the-equation-for-a-cubic-spline-from-cubic-spline-function htt...

7 years ago | 0

| accepted

Answered
Calculating K factor of a rice distribution
Use MATLAB's "mle" to fit K = A^2/(2*sigma^2) and OMEGA = A^2+2*sigma^2 for your data set: https://de.mathworks.com/help/stats/...

7 years ago | 0

| accepted

Load more