ODE15s with non-constant Jacobian
JacFun = J(u_int, deltaZ, Nz, cFeed); options = odeset( 'Jacobian' , @(t,x)JacFun(t, x, u_int, deltaZ, Nz, cFeed), 'RelTol',1e-...

9 giorni ago | 1

| accepted

Integration of the expected value
b = 1; N = 2000000; for i = 1:N p(i) = b*rand; pe(i) = p(i) + (b-p(i))*rand; p2(i) = p(i) + pe(i); end ecdf(p...

9 giorni ago | 1

| accepted

Why do I get the wrong value when I increase N?
a = 0; % Lower Boundary b = 10; % Upper Boundary fun = @(x)sin(pi*x/10); % Function zeta = [-sqrt(3/5) 0 sqrt(3/5)]; % absci...

9 giorni ago | 0

Trouble with least squares fit to 3D ODE model with 2D observed data
[~,Sv] = ode45(@(t,y) growth(t,y),t,y0); instead of Sv = ode45(@(t,y) growth(t,y),t,y0);

9 giorni ago | 0

How can I change the definition of x to find the value of y(3.5112)( i mean y(x1)) for this question ?
I don't know if it helps: %%main func clear all; close all; clf; clc; % Define the function x = linspace(-10,10,100); ...

9 giorni ago | 0

Trouble defining a set of parameters while using ode45 to solve a system of differential equations

10 giorni ago | 0

Finding the turning point on a curve
v = [-0.000499915992890149 -0.00136716055731299 -0.00312202879147695 -0.00415143850349407 -0.003723995799058...

10 giorni ago | 0

how to substitute a symbolic differential equation?
syms x(t) y(t) lambda h = 2*diff(x,t,2) + (diff(y,t))^2; xtt = diff(x,t,2); yt = diff(y,t); h_subs = subs(h,[xtt,yt],[lambda...

10 giorni ago | 0

| accepted

How to pre-allocate a double for following script ?
What about syncat = zeros(100000,2) ?

10 giorni ago | 1

| accepted

Getting a system of equations and the using ODE45
fun = @(x) Xi.'*[1;x(1);x(2);x(3);x(1)^2;x(1)*x(2);x(1)*x(3);x(2)^2;x(2)*x(3);x(3)^2;x(1)^3;x(1)^2*x(2);x(1)^2*x(3);x(1)*x(2)^2;...

11 giorni ago | 1

| accepted

i need to find the optimize values of R for a values in an interval but R values are in form of the root of the equation; how to solve this sir? for simple equation it was ok.
I think this is the safest way: syms R a p = -282091600255531819/9878934086330590709531986654911361482361187039433493704830155...

11 giorni ago | 0

| accepted

Index in position 3 exceeds array bounds (must not exceed 1)
"orph" has dimension 1 x 20000 because you overwrite the image by the command orph = [i,j]. Then you try to access orph(:,:,2)...

11 giorni ago | 1

| accepted

i need to find the optimize values of R for a values in an interval but R values are in form of the root of the equation; how to solve this sir? for simple equation it was ok.
Try "fmincon" for the problem min: R s.c. f(R,a) = 0 (f is the complete expression between "t=solve(" and "==0,R)) a_left <...

11 giorni ago | 0

Error using cat Dimensions of arrays being concatenated are not consistent.
Xtrain = cat(2,Xtrain,smat.'); would work, I guess.

12 giorni ago | 0

How to find L from the given code?
lags = 0.6; k1 = 3; k_1 = 1; k2 = 2.5; k3 = 1; k_3 = 1; k4 = 2; k5 = 1; E1 = 1; E2 = 2; K1 = (k_1+k2)/k1; K2 = (k_3+k...

12 giorni ago | 1

| accepted

i have to plot the percentage of heads by the times token is trowed times, in a game of head or tail, but a need help for doing that. What can I use in my plot?
N = 500; x=rand(1,N); for i = 1:length(x) if x(i) < 0.5 x(i) = 1; % cara else x(i) = 0; % coroa ...

12 giorni ago | 0

| accepted

ode15s solver produces wrong solution
t0 = 0; % initial time tf = 1; % final time nt = 20; % number of output times xl = 0; % left point xr = 1; % right point nx...

12 giorni ago | 0

| accepted

How to store n iterations of randomly generated matrices
n = 10 ; bounds = [1 100] ; %interval over which the random number generator will produce values randA = zeros(3,3); randA_al...

12 giorni ago | 0

Numerical answer to Partial derivative of Hopfield-style Energy in symbolic expression
p is (4x1), not (16x1). And keep r_mat as matrix, then E = -0.5*p.'*r_mat*p - c.'*p ( r_mat can be assumed symmetric ). By...

14 giorni ago | 0

| accepted

Error from ode15s
psi = 0.63; psip = 0.27; L = 150e-6; Ts = 60; k = 0.00158; q0 = 4.62e3; C0 =1.03; gama = 5021.8; Jw = 8.5e-6; a = psi*...

14 giorni ago | 0

Array indices must be positive integers or logical values.
e = exp(-SNR_index.^2./2) SNR_index is undefined. compute_the_Q = integral(@(SNR_index) (1/sqrt(2*pi)).*e, SNR_index,Inf,'Arra...

15 giorni ago | 0

How can I simulate Buffon's needle on MATLAB?
https://simonensemble.github.io/2018-04/buffon

15 giorni ago | 0

| accepted

Solve Three non-linear equations for 3 variables system
You might want to try a numerical solver, but the two I tested also didn't succeed. fun = @(A,B,C)[72000-(B*4000)/(log(A*4000)-...

15 giorni ago | 0

Coupled ODE using ODE15s with multiple outputs
When communicating with ODE15S, the solution must be treated as one vector of size 200, not as two vectors of size 100. E.g. f...

16 giorni ago | 0

| accepted

Is it possible to (non-linear) minimize x^y by choosing both x and y?
fun = @(x) x(1)^sqrt(x(2)); lb = [1.01,1.01]; ub = [100,2]; x0 = [1.01,1.01]; sol = fmincon(fun,x0,[],[],[],[],lb,ub,@nonlco...

16 giorni ago | 0

What is wrong in script?
I would have progrmmed it this way, but the result seems to be the same. My guess is that there is a mathematical trick to extr...

17 giorni ago | 0

How to generate plot
a = 5; n = 30; P0 = 100; c = 3; s = cos((2*(1:n)-1)*pi/(2*n)); x = a*s; P = P0*exp(-0.5*(x/c).^2).*(1-x/c).^2; K1 = sqrt(...

18 giorni ago | 1

What is an efficient way of finding the maximum value under a certain limit?
A = [1,2,3;4,5,6;7,8,9]; A(A>=8) = -Inf [m,i] = max(A,[],'All') [row,col] = ind2sub(size(A),i)

18 giorni ago | 1

| accepted