Answered
how to format the codes to compute the differential-algebraic equations using ode15s?
I don't see a way to use a MATLAB ode integrator to solve your system. Take a look at http://www.unige.ch/~hairer/software.htm...

2 years ago | 0

Answered
How to write a Matlab code for a sequence of functionals and their minimums
Your code: number_of_iterations = 3; A = @(alpha) ...; % Your NxN matrix A depending on alpha u = ...; % Your Nx1 ...

2 years ago | 0

| accepted

Answered
change the value of a parameter Lambda at each time step
% Experiemental data on 12 months time = 1:12 ; % experimental time 12 months Yc = [20 18 19 24 28 26 25 24 20 1...

2 years ago | 0

| accepted

Answered
Symbolic solution is too long
Did I take the wrong approach in solving this system of differential equations? It depends on what you want. If you want a gen...

2 years ago | 0

Answered
Solve function is unable to find an explicit solution
If you only want one possible solution, use x = solve(f,[T,L]) If you remove your assumptions, you get the general form of the...

2 years ago | 0

Answered
How can I fix "Index in position 2 exceeds array bounds" in for loop?
When you set b = a(1,1) , a is undefined in your code from above. Further, b is a scalar value, namely b = a(1,1). When you ...

2 years ago | 0

Answered
How can I analyze the sum and product together in a code?
rng("default") N = 10; mu = 1; alpha = rand(1,N); alphap = cumprod(alpha); fak = factorial(0:N); terms_numerator = alphap....

2 years ago | 0

Answered
Couple ODE System not enough Input arguments, Why?
If all boundary conditions are given at x = 0 as in your case, you have an initial value problem instead of a boundary value pro...

2 years ago | 1

Answered
Using of cumprod fuction
Tb=1.2; Hb=[2.8 2.2 1.7 1.2 0.8 0.6 0 0]; Sb=[25 28 32 36 35 38 0 0]; F=[70 50 48 55 80 65 0 0]; Sv=[0 280 200 320 360 380 4...

2 years ago | 0

| accepted

Answered
One program is not running after differentiation
clear all; clc; %%%%% parameter declaration %%% g1 = 10^(-4); g2 = 6; g3 = 0.66; g4 = 0.08; dp = 0; dc = 0; d3 = 0; d4 ...

2 years ago | 0

Answered
Graphing partial sums of a series
x = -5*pi : 0.01 : 5*pi; S1 = zeros(size(x)); for n = 1 : 100 S1 = S1 + 2/(2*n-1)*sin((2*n-1)*x)-2/(2*n)*sin(2*n*x); end...

2 years ago | 1

Answered
The sufficient and necessary conditon of fmincon funciton can find out the global optimal solution but not some other local optimal solutions
The answer is: there is no necessary and sufficient condition for "fmincon" to converge to the global optimum. I think it woul...

2 years ago | 1

Answered
How do I use fminunc with two variables?
You tell "fminunc" that you supply the gradient of the objective, but you don't do it. mu = [1, 10, 100, 1000]; tau = 1 ./ mu;...

2 years ago | 0

Answered
Simulation data Fittting problem
Call lsqcurvefit once as dr = @(params,r) (2 * besselj(1, r(:,1). * omega_p) ./ ((omega_m^2 - omega_p^2) * (kappa^2 + omega_m^2...

2 years ago | 0

Answered
Solve Function Doesn't Give All Solutions
Using x = solve(f,[T,L],'ReturnConditions',1) instead of x = solve(f,[T,L]) might help.

2 years ago | 0

| accepted

Answered
setting initial conditions for laplace transformation
L_eqn1 = subs(L_eqn1,[Xb(0) Xr(0) Xf(0) theta(0) Xb_1(0) Xr_1(0) Xf_1(0) theta_1(0)],[0 0 0 0 0 0 0 0]) Same for the other equa...

2 years ago | 0

| accepted

Answered
I am getting non-linear constraint error in the optimization problem
"solve" chooses MATLAB's "ga" to tackle your problem, but "ga" has the restriction that integer constraints and nonlinear inequa...

2 years ago | 0

Answered
Solution of nonlinear equation is different for different initial values
Most probably, your second system of 5 equations has multiple solutions. If you add the lines x0 = x_n; F = [f1(x0(1), x0(2...

2 years ago | 0

Answered
I need to input a matrix of size 2x2 which is something like this A= [ 1 - 1.8629z-1 + 0.8669z-2 , 0 ; 0 , 1 -1.8695z-1 + 0.8737z- 2 ] which is a 2x2 Matrix
Define A as a function of z: A = @(z)[1-1.8629*z,0;0,1-1.8695*z+0.8737*z^2]; A(2) or as a symbolic matrix syms z A(z) A(z)...

2 years ago | 0

Answered
Why do I receive a given error?
According to the error message, MotorSpeed, SleepSpeedThreshold_int_dbl and/or Tref_Ramp are arrays, not scalars. So if you wa...

2 years ago | 0

Answered
Fourier Series Curve Fitting and giving its coefficient with respect to eqaution
Two ways: x = [0.015404238 0.027389034 0.03937383 0.051358625 0.063343421 0.075328217 0.087313012 0.099297808 0.111282604 0.123...

2 years ago | 1

Answered
Weird difference between matlab's evaluation of elliptic integral to my implementation
You have to supply k^2, not k: ellipke(0.25)

2 years ago | 1

| accepted

Answered
Make this equation periodic (repeating every t_c seconds)
Maybe like this: Q_peak = 1; t_s = 0.1; t_c = 0.3; fun = @(t)Q_peak*sin((pi*t)./t_s).^2.*(t>=0).*(t<=t_s); F = @(t)fun(mod(...

2 years ago | 0

| accepted

Answered
Optimaloptions doesn't seem to work
You didn't include the "options" setting in the call to "fsolve": x= fsolve(f,[0.01,0.01,0.01,0.01,0.9,0.1,0.1,0.1,10000],optio...

2 years ago | 0

| accepted

Answered
Printing all outputs of the function that has been solved via ode45
Assuming m and h are scalars, use [time_vert,sol_vert]=ode45(@(t,x)endoFlightDeriv(t,x,E,L,PhaseCode),tspan,x0,options) for i ...

2 years ago | 1

Answered
boundary conditions at infinity
You must use a sufficiently large number instead of "Inf" here: x = linspace(0,Inf,100)

2 years ago | 0

Answered
lsqnonlin (lsqcurvefit , fmincon) does not change the variables in an optimization process to find the best fit
We don't know if you get modified values for the array "force" from "ABAQUS" if the input vector "x" to "sim_res" is slightly ch...

2 years ago | 2

| accepted

Answered
DIfferences on Sloped field using 'dsolve' and 'ode45'
The dsolve solution satisfies y(0) = 1: cond = y(0) == 1; the ode45 solution satisfies y(-5) = 1: [u,v] = ode45(f,[-5 5],1);...

2 years ago | 1

| accepted

Answered
How to integrate the Rice distribution and build a graph?
As written, H is an integration variable - you cannot prescribe a value for it since it runs from 0 to Inf. v = 1; sigma = 0.0...

2 years ago | 0

Answered
How to define a binary variable in non linear constraints
Solve two problems: One with x(1)+x(2)+x(3)>= 0 x(4)=1 the other with x(1)+x(2)+x(3)<= 0 x(4)=0 and take the best of the...

2 years ago | 0

Load more