Answered
i need help in use of f solve
FF= @(A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12)... [A4*sin(A10)/10;... A5*sin(A11)/10;... A6*sin(A12)/10;... 10^(1...

4 years ago | 0

Answered
Error using double (subs())
syms initial_R u = -100; alpha = 2; v = initial_R*exp((2*(1-alpha))/(2+(1-alpha)*u*initial_R)/(2-alpha*u*initial_R)^(alpha)^2...

4 years ago | 0

Answered
Hello, I need help with: Replace elements in Vector A with those of vector B of the same position, only if they meet a certain condition, otherwise replace by a zero. Thanks
I kept the values in A unchanged that are less or equal to Threshold. If you also want to replace them by 0, take David's answer...

4 years ago | 1

Answered
can I apply a for loop inside the function so that I can make my program short?
N = 5; ti = 0; tf = 10E-6; tspan = [ti tf]; [time,Y] = ode45(@(t,y)f(t,y,N),tspan,[1;1;1;1;1;1;1;1;1;1].*10E-6); function...

4 years ago | 0

| accepted

Answered
Grouping rows on the first column and obtain minimum value on second column
What do you mean by "group on the first column" ? A = [13 7 13 6 13 5 13 6 12 7 12 5]; A = sortrows(A...

4 years ago | 1

Answered
How to solve symbolic and trigonometric equations simultaneous, two unknowns
Your equation has several solution, as already demonstrated in a previous post. Here is one of them: syms alpha gamma %R d %...

4 years ago | 0

Answered
set Anonymous function through a series of matrix for "lsqcurvefit" or "lsqnonlin"
x0 = [0.3,0.4]; F = @(x,k) arrayfun(@(k)[2, 2, exp(k*x(1)), exp(k*x(2))] * [1; k; -1; -1],k) % same as above equation, but fro...

4 years ago | 0

| accepted

Answered
Plotting an integral function
L=1.5; h=.2; s=.75*L; tbar=1; y=0; icount = 0; for xbar=-1.5:.1:1.5 icount = icount + 1; if xbar>-L & s>xbar ...

4 years ago | 1

| accepted

Answered
I tried Euler's method and RK4 method but I'm getting different results. Please can someone help
%global x_vec dx k %clear %clc %clear all %%%% du/dt = d^2u/dx^2; u is f(x,t) %%%% DFM: (u(x, t+dt) -u(x, t))/dt = k*(u...

4 years ago | 0

Answered
"Trapz" function gives result different than what I calculate by hand
For x = y = [1 2 3 4 5], I = (1+2)/2 + (2+3)/2 + (3+4)/2 + (4+5)/2 = 24/2 = 12.

4 years ago | 1

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

4 years ago | 1

| accepted

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

4 years ago | 1

| accepted

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

4 years ago | 0

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

4 years ago | 0

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

4 years ago | 0

Answered
Trouble defining a set of parameters while using ode45 to solve a system of differential equations
This page should help you: https://de.mathworks.com/help/matlab/math/ode-event-location.html

4 years ago | 0

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

4 years ago | 0

| accepted

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

4 years ago | 0

| accepted

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

4 years ago | 1

| accepted

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

4 years ago | 1

| accepted

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

4 years ago | 0

| accepted

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

4 years ago | 1

| accepted

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

4 years ago | 0

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

4 years ago | 0

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

4 years ago | 1

| accepted

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

4 years ago | 0

| accepted

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

4 years ago | 0

| accepted

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

4 years ago | 0

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

4 years ago | 0

| accepted

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

4 years ago | 0

Load more