Answered
ODE Event Function not Properly Configured
Always work with function handles instead of strings: options1 = odeset('RelTol', 1e-8, 'AbsTol', 1e-8, 'Events', @reaching_L...

4 years ago | 1

| accepted

Answered
Different outputs of ode solvers inside for loop
This code gives reproducible results; I don't know exactly why your code didn't work. matrix=zeros(90,2); %Model Trace; t...

4 years ago | 0

Answered
Iterative code sequence error
f1 = 1; f2 = 1; f3 = 1; n = 10; f = sequence(n,f1,f2,f3) function f = sequence(n,f1,f2,f3) if n < 4 disp('Choose b...

4 years ago | 1

| accepted

Answered
May I know the default tolerance of the ode45?
odeset

4 years ago | 0

Answered
How to get the discriminant for symbolic quadractice equation?
I guess you mean d = b^2-4*a*c if the polynomial is given by p(x)=a*x^2+b*x+c. So the a and b in the discriminant have nothing t...

4 years ago | 0

Answered
MATLAB CODE of an equation including Bessel's function
Here is a very similar problem solved: https://de.mathworks.com/matlabcentral/answers/1777535-infinite-sum-with-bessel-s-functi...

4 years ago | 0

| accepted

Answered
plot function of two variables as one variable
%% initialization clear clc close all %% Model parameters global k1 eta1 alpha3 gamma1 d N Phi xi h A B C G k1 = 6*10^(-1...

4 years ago | 0

| accepted

Answered
I want to do a stop condition in ode45 that he demands dx=0
AnonFun=@(t,x)(5*x-1*x^2); Opt=odeset("Events",@(t,x)myEvent(t,x,AnonFun)); [t,x]=ode45(AnonFun,[0,5],1,Opt); plot(t,x) func...

4 years ago | 0

| accepted

Answered
Double integration of an array function
"integral2" has no "ArrayValued" option - only "integral" has. But since the function comes from a "MatlabFunction" command, I ...

4 years ago | 0

Answered
T is not defined, dont know how to fix
After deleting the @ before ode23t, the code with @locO works for me. %ODEs n0=[0 0 0]; % Initial conditions options = odes...

4 years ago | 0

Answered
How to optimise the computation of multiple integral for a specific integrand?
Precalculate q over the hypercube on a predefined regular mesh and use "trapz" dimensionwise. Look at the example "Multiple nu...

4 years ago | 1

| accepted

Answered
substitution in symbolic.
syms s w assume(w,'real') f = s + s^2; fs = subs(f,s,1i*w); fs_real = real(fs) fs_imag = imag(fs)

4 years ago | 1

Answered
Fit chi distribution to measurement data
Square your measurement data, and you can fit them against a chi-squared distribution.

4 years ago | 0

| accepted

Answered
Calculating and plotting conditional distribution.
You mean this lambda = 0.3; p_bar = 1; p_tilda = (1 - lambda)/(1 + lambda); S = 0:0.01:p_tilda; n = 1000000; icount = 0; ...

4 years ago | 1

| accepted

Answered
odeEvent doesn't terminate the integration process?
The functions you can prescribe as "value" should be continous. Using logicals leads to step functions that are not appropriate ...

4 years ago | 0

Answered
Giving a rectangular pulse in ode45
I can't evaluate the equations and initial conditions you use. This is what the solver returns - slight over-and undershooting. ...

4 years ago | 0

| accepted

Answered
Giving a rectangular pulse in ode45
time=linspace(0,20,300); is wrong. You must concatenate the t-vectors returned from ode45 in the three calls in the same way ...

4 years ago | 0

Answered
Calculating roots of an equation in Matlab.
Change syms theta a to syms theta

4 years ago | 0

Answered
how can i create Bernoulli random variable of a given probability
p = 0.2; n = 20000; A = binornd(ones(n,1),p) p_num = sum(A)/n B = 1 - A one_minus_p_num = sum(B)/n

4 years ago | 0

| accepted

Answered
Optimization: Reuse calculations from objective function in nonlinear constraints function
https://de.mathworks.com/help/optim/ug/objective-and-nonlinear-constraints-in-the-same-function.html

4 years ago | 2

| accepted

Answered
How apply the conformal mapping? (circle to rectangular)
https://de.mathworks.com/matlabcentral/fileexchange/67117-rectangular-conformal-map

4 years ago | 1

Answered
I'm having trouble plotting the temperature field for a thin plate with border temperatures known.
Write a function function T = Temp(x,y) T = ...; end in which you calculate the value of the infinite sum for x-y coordin...

4 years ago | 1

Answered
simultaneously, fitting two functions with two databases
I think you will have to work on the representation of f1 and f2 without the imaginary unit: c10 = 3.0; c210 = 1.0; c220 = -1...

4 years ago | 0

| accepted

Answered
Intersection of two curves
Do you see a point of intersection ? I don't. N = [1 2 3 4 5 6]; P = [1.48982012272225e-09 1.20413388047633e-08 4.174352140114...

4 years ago | 0

Answered
Error using SumOperator with Optimization Variables
nTasks = 3; nRess = 2; maxPT = 50; x = optimvar('x',nTasks,nRess,maxPT,'Type', 'integer','LowerBound',0,'UpperBound',1); Con...

4 years ago | 0

| accepted

Answered
plot based on if and else condition
MATLAB does not accept "double inequalities". Thus instead of if a < b < c you will have to use if a < b && b < c Further, ...

4 years ago | 0

Answered
Is ode45 always calculate the entire function even if she has been asked only for specific values?
I mean, will it do the full calculation in the background and return only 3 points? Yes, it will do the full calculation in the...

4 years ago | 1

| accepted

Answered
Constrained dynamic optimization with fmincon
J is minimized in the objective function. The constraint T(x(t_final)) = 0 is set in the function "nonlcon" of fmincon. u (and...

4 years ago | 0

| accepted

Answered
Where/How exactly do I create an ODE Event Location Function?
if option == 1 % Choosing Straight Run Vs = 10 * (1852 / 3600); % [m/s]-S...

4 years ago | 1

| accepted

Answered
How to solve a system of equations using the iteration by assuming the values of the unknowns and check them later. If the error is large return to change the assumed values.
Unknowns are epsilon_ri and zi. Equations are sigma_Ti = 0 and psi_i = psi_i_given. Two equations in two unknowns. Use MATLAB...

4 years ago | 0

| accepted

Load more