Answered
Integral from 0 to inf with imaginary numbers takes too long
It seems your integral does not exist. Note that by default, y is integrated with respect to x. I don't know if this is wanted ...

3 years ago | 0

Answered
trouble in make if statement simulation
Depends on what you want to achieve by the if-statement. You can either use if x(6)>0 && x(7)>0 H = 1; end to set H=1 i...

3 years ago | 0

| accepted

Answered
Wihle loop not running
At first (by your setting) v1 = 0. Thus the while loop is entered. After entering the while loop, v1 becomes x1 + y1 = [2 3 4 5...

3 years ago | 0

Answered
Calculate the difference between minimum values of a parabola and straight line (from a plot)
syms h V W S rho cd0 k cl Psl eqn = V == sqrt(2*W/rho/S/cl); cl = solve(eqn,cl); cd = cd0 + k * cl^2; D = 0.5 * rho * V * V ...

3 years ago | 1

Answered
I could'not understand why my plot doesnot show line?
plot(eta,f(2,:),'r') instead of plot(eta,f(2),'r')

3 years ago | 0

| accepted

Answered
Using a function and fsolve with a for loop
Look whether this might help. syms T x = sym('x',[1 4]); eqn1 = 10.*(T-x(1))+0.2.*(T.^4-x(1).^4) - x(4) == 0; eqn2 = -1.*(1/...

3 years ago | 0

Answered
Minimize a function with special constraints
Use "linprog". There are a lot of examples on how to use the solver under https://de.mathworks.com/help/optim/ug/linprog.html ...

3 years ago | 0

Answered
Use of fmincon to contain all data points with circle
rng("default") up_bound = 1000; x_r = -5 + (5+5)*rand(up_bound,2); tspan = [0 30]; f = @(t,y) [y(2);(1-y(1)^2)*y(2) - y(1)];...

3 years ago | 0

| accepted

Answered
taking the inverse of multiple matrix's
What am I doing wrong? Nothing. But some or all of the sigma matrices that you try to invert seem to be singular.

3 years ago | 0

| accepted

Answered
How to do the following two for loop?
You mean i=0.1:0.1:0.9 ; M = [i.',ones(numel(i),5)] ?

3 years ago | 0

| accepted

Answered
LINPROG requires the following inputs to be of data type double: 'f'.
y= readtable('y.crra.csv'); % 249 x 1 y=table2array(y); reg1=readtable('fitted.reg1.csv'); reg1=table2array(reg1); trareg1...

3 years ago | 0

| accepted

Answered
Undefined function or variable 'e'
@(x,y)exp(-(x.^2 +y.^2)).* (x.^2 +y.^2) instead of @(x,y)e^(-x.^2-y.^2)*(x.^2+y.^2)

3 years ago | 0

| accepted

Answered
Can't integrate function using Matlab
L_bar=25; sigma_d =[0.25, 0.5, 0.75, 1.0]; mu = log(L_bar) - 0.5*(sigma_d).^2; L_tilda = exp(mu); r = 0:100; for ii=1:nume...

3 years ago | 0

| accepted

Answered
Scaling of a system of coupled differential equation and is it possible?
If possible, use different units for physical parameters involved such that values like exp(-1.48e36*(x(1)^2)), exp(-6.0653e35*(...

3 years ago | 0

| accepted

Answered
Trouble superimposing two functions onto the same graph. One is correct, the other is incorrect.
y2 = cos(x)./(x.^2 + 1) - atan(x).*sin(x); instead of y2 = cos(x)/(x.^2 + 1) - atan(x).*sin(x); %% Define x variables x = ...

3 years ago | 1

| accepted

Answered
What does this script mean?
What is VN ? Where is the function "tauxZC2" ? As written, the code tries to find a value of x that minimizes (c/x*(1-1/(1+x)^t...

3 years ago | 0

| accepted

Answered
How to solve a non-linear optimization problem with matrix and vector decision variables?
I turned deltaB into a diagonal matrix. I changed m to 130 and it works. Are you sure a solution exists for m = 120 ? %% Input...

3 years ago | 1

| accepted

Answered
Issue with probability density function
histogram(Output,'Normalization', 'pdf');

3 years ago | 0

Answered
Hi, I would need the algebraicly solved two equations for X and Y of the intersection points of two circles to write them as algorithms in a graphics language. Thanks
syms x y x1 y1 x2 y2 r1 r2 real eqn1 = (x-x1)^2+(y-y1)^2==r1^2; eqn2 = (x-x2)^2+(y-y2)^2==r2^2; sol = solve([eqn1,eqn2],[x y]...

3 years ago | 0

Answered
Code for the Maximum likelihood esitmate for the gamma distribution , both parameters unknown
format long data = [27,82,115,126,155,161,243,294,340,384,457,680,855,877,974,1193,1340,1884,2558,15743]; p = mle(data,'Distri...

3 years ago | 0

Answered
2nd order differential equation
Use MATLAB's "pdepe" with m = 2 (radial coordinates).

3 years ago | 0

Answered
solve ODE using finite difference method
This is a PDE, not an ODE. Use "pdepe" to solve.

3 years ago | 0

Answered
Unable to meet integration tolerances without reducing the step size problem.
You define an initial condition for x(1) as 0, but you divide by x(1) in equations 1 and 2. This won't work.

3 years ago | 1

Answered
coupled ode for 2nd order
I didn't compare equations and boundary conditions with those listed above. % Defining parameters delta = 0.02; % L...

3 years ago | 1

Answered
Epicycloid curve calculating arch length using integral method
curvelength = vpaintegral(sqrt(diff(x,t)^2+diff(y,t)^2),t,0,T)

3 years ago | 0

| accepted

Answered
Find the value from the integral equation
fun = @(w,m0) (cos(4*w).*cos(4*w)+1)./(1+exp(w-m0)); m0sol = fsolve(@(m0)integral(@(w)fun(w,m0),-20,20)-2,1) integral(@(w)fun(...

3 years ago | 1

Answered
How to match indices of a matrix and how to define functions correctly in matlab
As you can see, Xnew is a 2x2 matrix. You want to assign a matrix to a vector in pos(i,:)=Xnew; which is not possible. Trace...

3 years ago | 0

Answered
maximisation of the utility function , portfolio optimization
Calculate W1*Rt1, W2*Rt2,...,W4*Rt4. Let Wi*Rti be maximum. Then (assuming gamma < 1) x_i = 1, x_j = 0 for i~=j is optimal.

3 years ago | 0

| accepted

Answered
Are there any restrictions on the Mass matrix for solving a DAE system using ode23t?
There are no restrictions on the mass matrix for ode23t or ode15s except for that it cannot be the zero matrix (which would mean...

3 years ago | 0

| accepted

Load more